如何检测iphone4s

时间:2011-10-18 06:09:49

标签: ios iphone

  

可能重复:
  Determine device (iPhone, iPod Touch) with iOS

我正在使用UIDevice (Hardware) by Erica Sadun来检测设备信息 如何检测它是否是iphone4s设备?

1 个答案:

答案 0 :(得分:-2)

要检测特定型号,您需要测试只有该型号具有的功能,以便检测iPhone 3GS,检查相机上的视频功能:

#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];
}

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