0

I'm writing an app that needs to function 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?

derekvanvliet
  • 649
  • 8
  • 17

2 Answers2

2

See here:

how do I detect whether I have iPhone 2G,3G,3GS

Community
  • 1
  • 1
Adolfo
  • 3,066
  • 3
  • 24
  • 28
2

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.

Sixten Otto
  • 14,781
  • 3
  • 47
  • 60
  • You hit on what I'm trying to do actually. I want to support the compass when it is available and when it isn't, do something else entirely. – derekvanvliet Oct 14 '09 at 20:45