-
-
Save lbrndnr/1239394 to your computer and use it in GitHub Desktop.
PSIsCrappyDevice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOOL PSIsCrappyDevice() { | |
static BOOL isCrappyDevice = YES; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
size_t size; | |
sysctlbyname("hw.machine", NULL, &size, NULL, 0); | |
char *machine = malloc(size); | |
sysctlbyname("hw.machine", machine, &size, NULL, 0); | |
NSString *platform = [[NSString alloc] initWithCString:machine]; | |
free(machine); | |
isCrappyDevice = !(![platform hasPrefix:@"iP"] || [platform hasPrefix:@"iPhone3"] || [platform isEqualToString:@"iPod4,1"] || [platform hasPrefix:@"iPad2"]); | |
[platform release]; | |
}); | |
return isCrappyDevice; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not all current devices have retina, so I wouldn't consider it a downgrade. There might be room for a cheaper model of the next iPhone/iPad, and we never know the specs. There's definitely neither of the methods perfect, I'm just not sure what's easier to break (so which method I should add to iOSKit :) ).