Skip to content

Instantly share code, notes, and snippets.

@steipete
Created September 24, 2011 13:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save steipete/1239338 to your computer and use it in GitHub Desktop.
Save steipete/1239338 to your computer and use it in GitHub Desktop.
PSIsCrappyDevice
BOOL PSIsCrappyDevice(void) {
static BOOL isCrappyDevice = YES;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
BOOL isSimulator = NO;
BOOL isIPad2 = (PSIsIpad() && [UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]);
BOOL hasRetina = [[UIScreen mainScreen] scale] > 1.f;
// enable animations on simulator
#if TARGET_IPHONE_SIMULATOR
isSimulator = YES;
#endif
if (isIPad2 || hasRetina || isSimulator) {
isCrappyDevice = NO;
}
});
return isCrappyDevice;
}
@grgcombs
Copy link

You could just explicitly start listing the crappy devices ... that way the logic isn't so complicated ... it might be long though ...

Pippen = YES;
Newton = YES;
eMac = YES;
iPod1G = YES;
iPhone3G = YES;
...
...
...

:)

@lbrndnr
Copy link

lbrndnr commented Oct 10, 2011

This returns NO for an iPod Touch but not for an iPad 1.

@steipete
Copy link
Author

Wrong, it returns NO for an iPad1 because it neither has retina nor has a camera.

@lbrndnr
Copy link

lbrndnr commented Oct 10, 2011

True that. Took a look at my version of it. Anyway, why does it return NO for an iPod touch 4? They iPod touch isn't that good.

@steipete
Copy link
Author

The latest iPod touch now has an A4 and retina, so it returns YES there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment