Possible Duplicate:
Detecting iPad 3 vs iPad 2 device?
Programmatically detect an iPad 3 (HD)?
I am making an iPad app and want to know if the app is running in an iPad 2 or 3 so accordingly I can perform some action.
What would be the best way to find this?
I am currently using
NSString *platform = [[UIDevice currentDevice] platformString];
But it returns "Unknown iPad" when I run on iPad 3.
It's generally best to check for the device features you're interested in rather than looking for a specific model of device. Apple recommends this, and for good reason: if you design for features of the new iPad, your customers won't be happy if Apple releases another device with those features and your app doesn't support them.
If you need to determine whether you're on an iPad, check UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
. If you need to see if you have a Retina display, check [UIScreen mainScreen].scale
. Combine the two and you can find out if you're on an iPad with Retina display.
If you need other features specific to the new iPad, look in the API for those features: AV Foundation can tell you about the capabilities of the built-in camera, for example. There's probably some way to check for LTE, too, but I'm not aware of it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With