识别 判断 iOS设备 信息


EITHER try this library: http://github.com/erica/uidevice-extension/ (by Erica Sadun).


(Sample Code):


[[UIDevice currentDevice] platformType]   // ex: UIDevice4GiPhone
[[UIDevice currentDevice] platformString] // ex: @"iPhone 4G"

OR You can use this method:


You can get the device model number using uname from sys/utsname.h. For example:



[[UIDevice currentDevice] platformType]   // ex: UIDevice4GiPhone
[[UIDevice currentDevice] platformString] // ex: @"iPhone 4G"
OR You can use this method:

 #import <sys/utsname.h> // import it in your header or implementation file.

NSString* deviceName()
{
    struct utsname systemInfo;
    uname(&systemInfo);

    return [NSString stringWithCString:systemInfo.machine
                              encoding:NSUTF8StringEncoding];
}
The result should be:

@"i386"      on 32-bit Simulator
@"x86_64"    on 64-bit Simulator
@"iPod1,1"   on iPod Touch
@"iPod2,1"   on iPod Touch Second Generation
@"iPod3,1"   on iPod Touch Third Generation
@"iPod4,1"   on iPod Touch Fourth Generation
@"iPod7,1"   on iPod Touch 6th Generation
@"iPhone1,1" on iPhone
@"iPhone1,2" on iPhone 3G
@"iPhone2,1" on iPhone 3GS
@"iPad1,1"   on iPad
@"iPad2,1"   on iPad 2
@"iPad3,1"   on 3rd Generation iPad
@"iPhone3,1" on iPhone 4 (GSM)
@"iPhone3,3" on iPhone 4 (CDMA/Verizon/Sprint)
@"iPhone4,1" on iPhone 4S
@"iPhone5,1" on iPhone 5 (model A1428, AT&T/Canada)
@"iPhone5,2" on iPhone 5 (model A1429, everything else)
@"iPad3,4" on 4th Generation iPad
@"iPad2,5" on iPad Mini
@"iPhone5,3" on iPhone 5c (model A1456, A1532 | GSM)
@"iPhone5,4" on iPhone 5c (model A1507, A1516, A1526 (China), A1529 | Global)
@"iPhone6,1" on iPhone 5s (model A1433, A1533 | GSM)
@"iPhone6,2" on iPhone 5s (model A1457, A1518, A1528 (China), A1530 | Global)
@"iPad4,1" on 5th Generation iPad (iPad Air) - Wifi
@"iPad4,2" on 5th Generation iPad (iPad Air) - Cellular
@"iPad4,4" on 2nd Generation iPad Mini - Wifi
@"iPad4,5" on 2nd Generation iPad Mini - Cellular
@"iPad4,7" on 3rd Generation iPad Mini - Wifi (model A1599)
@"iPhone7,1" on iPhone 6 Plus
@"iPhone7,2" on iPhone 6
@"iPhone8,1" on iPhone 6S
@"iPhone8,2" on iPhone 6S Plus

来自

http://stackoverflow.com/questions/11197509/ios-how-to-get-device-make-and-model

时间: 2024-12-26 12:37:11

识别 判断 iOS设备 信息的相关文章

如何判断 ios设备的类型(iphone,ipod,ipad)

-(bool)checkDevice:(NSString*)name { NSString* deviceType = [UIDevice currentDevice].model; NSLog(@"deviceType = %@", deviceType); NSRange range = [deviceType rangeOfString:name]; return range.location != NSNotFound; } NSString * [email protecte

iOS 设备信息

在iOS开发中,有时候我们需要使用跟设备相关的一些信息,下面就详细介绍一下设备相关信息: 1.获取当前设备所有者名称: 2.获取设备的类别,是iPhone,iPod,还是iPad 这里要获取iPhone的具体类型,要有如下代码: - (NSString *)deviceString { // 需要#import "sys/utsname.h" struct utsname systeminfo; uname(&systeminfo); NSString *deviceStrin

iOS 设备信息获取

参考:http://blog.csdn.net/decajes/article/details/41807977参考:http://zengrong.net/post/2152.htm1. 获取设备的信息 UIDevice *device = [[UIDevice alloc] init]; NSString *name = device.name; NSString *model = device.model; // 设备类型,比如是苹果还是itouch NSString *type = de

获取iOS设备信息

有时候做项目是需要获取手机的相关信息,好让用户知道自己的使用情况: 镔哥就直接写代码了 /* 获取手机信息 应用程序的名称和版本号等信息都保存在mainBundle的一个字典中,用下面代码可以取出来 */ NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary]; NSString* versionNum =[infoDict objectForKey:@"CFBundleVersion"]; NSString*app

显示ios设备信息的程序

以下是运行在本人iphone4上的截图,支持中文简体,中文繁体,英文,支持iphone和ipad,当然由于没有ipad,ipad的测试用的模拟器.支持iphone4的Retina屏幕.本来有6个标签,但是iphone的很多信息实在得不到,现在只剩下了4个标签. 这里面的电量精确到0.01,用的undocument api,但是个人感觉总是比右上角系统自己显示的偏低3%以内. 显示当前运行的进程,但是不知道如何得到进程的图标,因此统一用的图标. 一些硬件信息,iphone4的A4 cpu频率实际上

如何判断ios设备中是否安装了某款应用

URL Schemes关键字研究一下即可 常见得URL Schemes见http://www.cnblogs.com/huangzs/p/4491286.html if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"alipay://"]]) { NSLog(@" installed"); NSURL *url = [NSURL URLWithString:@"a

判断iOS设备型号

NSString* clientModel() {     NSString *model = [[UIDevice currentDevice] model];     if ([model isEqualToString:@"iPhone1,1"])    return @"iPhone 1G";     if ([model isEqualToString:@"iPhone1,2"])    return @"iPhone 3G&

判断iOS设备是否越狱

- (BOOL)isJailbroken { BOOL jailbroken = NO; NSString *cydiaPath = @"/Applications/Cydia.app"; NSString *aptPath = @"/private/var/lib/apt/"; if ([[NSFileManagerdefaultManager] fileExistsAtPath:cydiaPath]) { jailbroken = YES; } if ([[NS

[转载]iOS开发:获取设备信息

开发iOS平台的应用的时候,可以获取iOS设备的设备信息,包括设备的名称,设备的机型,设备的iOS版本等等.设备信息主要来自 UIDevice 类. UIDevice *currentDevice = [UIDevice currentDevice]; NSString *strName = currentDevice.name; //设备名称 NSString *strModel = currentDevice.model; //设备类别 NSString *strLocalizedModel