1

Possible Duplicate:
Determine device (iPhone, iPod Touch) with iOS

I am using UIDevice (Hardware) by Erica Sadun to detect the device info.
How to detect if it's an iphone4s device?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Fourj
  • 1,817
  • 1
  • 18
  • 34
  • 1
    It is always better you check certain capabilities are present rather than checking for device model.. – Krishnabhadra Oct 18 '11 at 06:26
  • @Krishnabhadra Just wants to get the device model when got a bug report. – Fourj Oct 18 '11 at 07:51
  • This post gives a sample code you could use to do what you need : http://stackoverflow.com/questions/448162/determine-device-iphone-ipod-touch-with-iphone-sdk – Oliver Oct 20 '11 at 13:06

1 Answers1

-2

To detect a specific model, you would need to test for some capability that only that model has, so to detect an iPhone 3GS, check for a video capability on the camera:

#define SOURCETYPE UIImagePickerControllerSourceTypeCamera

// does the device have a camera?
if ([UIImagePickerController isSourceTypeAvailable:SOURCETYPE]) {
  // if so, does that camera support video?
  NSArray *mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:SOURCETYPE];
  bool isA3GS = [mediaTypes containsObject:kUTTypeMovie];
}

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

Community
  • 1
  • 1
UPT
  • 1,490
  • 9
  • 25