How to check if the device is iPad 3?

Possible duplicate:
Detecting iPad 3 vs iPad 2? Programmatically detect iPad 3 (HD)?

I am making an iPad application and want to know if the application works in iPad 2 or 3, so I can perform some actions.

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 launch iPad 3.

+4
source share
1 answer

As a rule, it is best to check the features of the device that interest you, rather than look for a specific device model. Apple recommends this, and for a good reason: if you are developing features for the new iPad, your customers will not be happy if Apple launches another device with these features, and your application does not support them.

If you need to determine if you are on an iPad, check UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad . If you need to see if you have a Retina display, [UIScreen mainScreen].scale . Combine the two and you can find out if you have an iPad with a Retina display.

If you need other features specific to the new iPad, look at the API for these features: for example, the AV Foundation can tell you about the capabilities of the built-in camera. There is probably a way to test LTE, but I don't know about that.

+11
source

Source: https://habr.com/ru/post/1402522/


All Articles