如何检测iphone4s [重复]

问题描述 投票:1回答:1

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

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

ios iphone
1个回答
-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

© www.soinside.com 2019 - 2024. All rights reserved.