如何检测我是否有iPhone 2G,3G,3GS [英] how do I detect whether I have iPhone 2G,3G,3GS
本文介绍了如何检测我是否有iPhone 2G,3G,3GS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想检测我当前的设备名称。如何通过iPhone SDK检测到它?
另外我如何检测iPhone是否没有插入SIM卡?
I want to detect my current device name. How do I detect it through iPhone SDK? Also how do I detect if the iPhone doesn't have a SIM inserted?
推荐答案
无论你是否在iPhone或iPod Touch:
Whether you are on an iPhone or a iPod Touch:
UIDevice *device = [UIDevice currentDevice];
NSString *systemName = [device systemName];
要检测操作系统的版本:
To detect the version of the OS:
UIDevice *device = [UIDevice currentDevice];
NSString *systemVersion = [device systemVersion];
要检测特定模型,您需要测试只有该模型具有的某些功能,因此要检测iPhone 3GS,请检查相机上的视频功能:
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];
}
这篇关于如何检测我是否有iPhone 2G,3G,3GS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文