如何通过iOS检测我当前的设备名称?
最佳答案
无论您使用的是 iPhone 还是 iPod Touch:
UIDevice *device = [UIDevice currentDevice];
NSString *systemName = [device systemName];
检测操作系统版本:
UIDevice *device = [UIDevice currentDevice];
NSString *systemVersion = [device systemVersion];
要检测特定型号,您需要测试只有该型号才有的某些功能,因此要检测 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];
}
关于ios - 如何检测我是否拥有 iPhone 2G,3G,3GS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1543925/