获得ios设备版本
程序员文章站
2022-11-05 13:25:40
获得ios设备版本。
/**
* 获取保存用户信息的字典
*
* @return 用户信息字典
*/
+ (nsstring*)devicestring
{...
获得ios设备版本。
/** * 获取保存用户信息的字典 * * @return 用户信息字典 */ + (nsstring*)devicestring { struct utsname systeminfo; uname(&systeminfo); nsstring *platform = [nsstring stringwithcstring:systeminfo.machine encoding:nsutf8stringencoding]; if ([platform isequaltostring:@"iphone1,1"]) return @"iphone 2g (a1203)"; if ([platform isequaltostring:@"iphone1,2"]) return @"iphone 3g (a1241/a1324)"; if ([platform isequaltostring:@"iphone2,1"]) return @"iphone 3gs (a1303/a1325)"; if ([platform isequaltostring:@"iphone3,1"]) return @"iphone 4 (a1332)"; if ([platform isequaltostring:@"iphone3,2"]) return @"iphone 4 (a1332)"; if ([platform isequaltostring:@"iphone3,3"]) return @"iphone 4 (a1349)"; if ([platform isequaltostring:@"iphone4,1"]) return @"iphone 4s (a1387/a1431)"; if ([platform isequaltostring:@"iphone5,1"]) return @"iphone 5 (a1428)"; if ([platform isequaltostring:@"iphone5,2"]) return @"iphone 5 (a1429/a1442)"; if ([platform isequaltostring:@"iphone5,3"]) return @"iphone 5c (a1456/a1532)"; if ([platform isequaltostring:@"iphone5,4"]) return @"iphone 5c (a1507/a1516/a1526/a1529)"; if ([platform isequaltostring:@"iphone6,1"]) return @"iphone 5s (a1453/a1533)"; if ([platform isequaltostring:@"iphone6,2"]) return @"iphone 5s (a1457/a1518/a1528/a1530)"; if ([platform isequaltostring:@"iphone7,1"]) return @"iphone 6 plus (a1522/a1524)"; if ([platform isequaltostring:@"iphone7,2"]) return @"iphone 6 (a1549/a1586)"; if ([platform isequaltostring:@"iphone8,1"]) return @"iphone 6 s (a1522/a1524)"; if ([platform isequaltostring:@"iphone8,2"]) return @"iphone 6 s plus"; // if ([platform isequaltostring:@"ipod1,1"]) return @"ipod touch 1g (a1213)"; // if ([platform isequaltostring:@"ipod2,1"]) return @"ipod touch 2g (a1288)"; // if ([platform isequaltostring:@"ipod3,1"]) return @"ipod touch 3g (a1318)"; // if ([platform isequaltostring:@"ipod4,1"]) return @"ipod touch 4g (a1367)"; // if ([platform isequaltostring:@"ipod5,1"]) return @"ipod touch 5g (a1421/a1509)"; // // if ([platform isequaltostring:@"ipad1,1"]) return @"ipad 1g (a1219/a1337)"; // // if ([platform isequaltostring:@"ipad2,1"]) return @"ipad 2 (a1395)"; // if ([platform isequaltostring:@"ipad2,2"]) return @"ipad 2 (a1396)"; // if ([platform isequaltostring:@"ipad2,3"]) return @"ipad 2 (a1397)"; // if ([platform isequaltostring:@"ipad2,4"]) return @"ipad 2 (a1395+new chip)"; // if ([platform isequaltostring:@"ipad2,5"]) return @"ipad mini 1g (a1432)"; // if ([platform isequaltostring:@"ipad2,6"]) return @"ipad mini 1g (a1454)"; // if ([platform isequaltostring:@"ipad2,7"]) return @"ipad mini 1g (a1455)"; // // if ([platform isequaltostring:@"ipad3,1"]) return @"ipad 3 (a1416)"; // if ([platform isequaltostring:@"ipad3,2"]) return @"ipad 3 (a1403)"; // if ([platform isequaltostring:@"ipad3,3"]) return @"ipad 3 (a1430)"; // if ([platform isequaltostring:@"ipad3,4"]) return @"ipad 4 (a1458)"; // if ([platform isequaltostring:@"ipad3,5"]) return @"ipad 4 (a1459)"; // if ([platform isequaltostring:@"ipad3,6"]) return @"ipad 4 (a1460)"; // // if ([platform isequaltostring:@"ipad4,1"]) return @"ipad air (a1474)"; // if ([platform isequaltostring:@"ipad4,2"]) return @"ipad air (a1475)"; // if ([platform isequaltostring:@"ipad4,3"]) return @"ipad air (a1476)"; // if ([platform isequaltostring:@"ipad4,4"]) return @"ipad mini 2g (a1489)"; // if ([platform isequaltostring:@"ipad4,5"]) return @"ipad mini 2g (a1490)"; // if ([platform isequaltostring:@"ipad4,6"]) return @"ipad mini 2g (a1491)"; // // if ([platform isequaltostring:@"i386"]) return @"iphone simulator"; // if ([platform isequaltostring:@"x86_64"]) return @"iphone simulator"; return platform; }
上一篇: Python—推导式
下一篇: 吃饭的时候多放点辣椒