How can I check what hardware my iPhone app is running on?
I'm writing an app that needs to fun开发者_JAVA技巧ction differently if it is running on different models of the iPhone/iPod Touch. How can I check if the app is running on 3GS, 3G or other?
See here:
how do I detect whether I have iPhone 2G,3G,3GS
The UIDevice
class provides some information like this.
But you're probably much better off testing for capabilities ("does this device support compass headings?") than for specific models ("is this device a 3GS?"). What is it that you're trying to do?
Edit: for the specific example I presented above, see the headingAvailable
property of CLLocationManager
. It will be YES
if and only if heading information can be obtained from the device.
精彩评论