Skip to content

Instantly share code, notes, and snippets.

@newmarcel
Created November 12, 2012 11:48
Show Gist options
  • Save newmarcel/4058921 to your computer and use it in GitHub Desktop.
Save newmarcel/4058921 to your computer and use it in GitHub Desktop.
iPad Mini First Generation Detection (Needs actual device testing!)
#import <UIKit/UIKit.h>
@interface UIDevice (iPadMini)
@property (nonatomic, readonly, getter = isMiniModel) BOOL miniModel;
@end
#import "UIDevice_iPadMini.h"
#include <sys/utsname.h>
@implementation UIDevice (iPadMini)
- (BOOL)isMiniModel
{
struct utsname deviceData;
uname(&deviceData);
NSString * machine = [NSString stringWithCString:deviceData.machine encoding:NSUTF8StringEncoding];
NSArray * iPadMiniFirstGenDeviceIdentifiers = @[
@"iPad2,5", // WiFi
@"iPad2,6", // GSM
@"iPad2,7", // CDMA
];
NSArray * results = [iPadMiniFirstGenDeviceIdentifiers filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF == %@", machine]];
if( [results count] > 0 )
return YES;
else
return NO;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment