iOS 获取设备版本型号
#import "sys/utsname.h"
/**
* 设备版本
*
* @return e.g. iPhone 5S
*/
+ (NSString*)deviceVersion {
// 需要#import "sys/utsname.h"
struct utsname systemInfo;
uname(&systemInfo);
NSString *deviceString = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
//iPhone
if ([deviceString isEqualToString:@"iPhone1,1"]) return @"iPhone 1G";
if ([deviceString isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
if ([deviceString isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";
if ([deviceString isEqualToString:@"iPhone3,1"]) return @"iPhone 4";
if ([deviceString isEqualToString:@"iPhone3,2"]) return @"Verizon iPhone 4";
if ([deviceString isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
if ([deviceString isEqualToString:@"iPhone5,1"]) return @"iPhone 5";
if ([deviceString isEqualToString:@"iPhone5,2"]) return @"iPhone 5";
if ([deviceString isEqualToString:@"iPhone5,3"]) return @"iPhone 5C";
if ([deviceString isEqualToString:@"iPhone5,4"]) return @"iPhone 5C";
if ([deviceString isEqualToString:@"iPhone6,1"]) return @"iPhone 5S";
if ([deviceString isEqualToString:@"iPhone6,2"]) return @"iPhone 5S";
if ([deviceString isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
if ([deviceString isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
if ([deviceString isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
if ([deviceString isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
if ([deviceString isEqualToString:@"iPhone8,4"]) return @"iPhone SE";
if ([deviceString isEqualToString:@"iPhone9,1"]) return @"iPhone 7";
if ([deviceString isEqualToString:@"iPhone9,3"]) return @"iPhone 7";
if ([deviceString isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";
if ([deviceString isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus";
//iPod
if ([deviceString isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G";
if ([deviceString isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G";
if ([deviceString isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G";
if ([deviceString isEqualToString:@"iPod4,1"]) return @"iPod Touch 4G";
if ([deviceString isEqualToString:@"iPod5,1"]) return @"iPod Touch 5G";
if ([deviceString isEqualToString:@"iPod7,1"]) return @"iPod Touch 6G";
//iPad
if ([deviceString isEqualToString:@"iPad1,1"]) return @"iPad";
if ([deviceString isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)";
if ([deviceString isEqualToString:@"iPad2,2"]) return @"iPad 2 (GSM)";
if ([deviceString isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)";
if ([deviceString isEqualToString:@"iPad2,4"]) return @"iPad 2 (32nm)";
if ([deviceString isEqualToString:@"iPad2,5"]) return @"iPad mini (WiFi)";
if ([deviceString isEqualToString:@"iPad2,6"]) return @"iPad mini (GSM)";
if ([deviceString isEqualToString:@"iPad2,7"]) return @"iPad mini (CDMA)";
if ([deviceString isEqualToString:@"iPad3,1"]) return @"iPad 3(WiFi)";
if ([deviceString isEqualToString:@"iPad3,2"]) return @"iPad 3(CDMA)";
if ([deviceString isEqualToString:@"iPad3,3"]) return @"iPad 3(4G)";
if ([deviceString isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)";
if ([deviceString isEqualToString:@"iPad3,5"]) return @"iPad 4 (4G)";
if ([deviceString isEqualToString:@"iPad3,6"]) return @"iPad 4 (CDMA)";
if ([deviceString isEqualToString:@"iPad4,1"]) return @"iPad Air";
if ([deviceString isEqualToString:@"iPad4,2"]) return @"iPad Air";
if ([deviceString isEqualToString:@"iPad4,3"]) return @"iPad Air";
if ([deviceString isEqualToString:@"iPad5,3"]) return @"iPad Air 2";
if ([deviceString isEqualToString:@"iPad5,4"]) return @"iPad Air 2";
if ([deviceString isEqualToString:@"i386"]) return @"Simulator";
if ([deviceString isEqualToString:@"x86_64"]) return @"Simulator";
if ([deviceString isEqualToString:@"iPad6,7"]) return @"iPad Pro";
if ([deviceString isEqualToString:@"iPad6,8"]) return @"iPad Pro";
if ([deviceString isEqualToString:@"iPad6,3"]) return @"iPad Pro";
if ([deviceString isEqualToString:@"iPad6,4"]) return @"iPad Pro";
if ([deviceString isEqualToString:@"iPad4,4"]
||[deviceString isEqualToString:@"iPad4,5"]
||[deviceString isEqualToString:@"iPad4,6"]) return @"iPad mini 2";
if ([deviceString isEqualToString:@"iPad4,7"]
||[deviceString isEqualToString:@"iPad4,8"]
||[deviceString isEqualToString:@"iPad4,9"]) return @"iPad mini 3";
if ([deviceString isEqualToString:@"iPad5,1"]
||[deviceString isEqualToString:@"iPad5,2"]) return @"iPad mini 4";
//Apple Watch
if ([deviceString isEqualToString:@"Watch1,1"]) return @"Apple Watch";
if ([deviceString isEqualToString:@"Watch1,2"]) return @"Apple Watch";
if ([deviceString isEqualToString:@"Watch2,6"]) return @"Apple Watch Series 1";
if ([deviceString isEqualToString:@"Watch2,7"]) return @"Apple Watch Series 1";
if ([deviceString isEqualToString:@"Watch2,3"]) return @"Apple Watch Series 2";
if ([deviceString isEqualToString:@"Watch2,4"]) return @"Apple Watch Series 2";
//Apple TV
if ([deviceString isEqualToString:@"AppleTV2,1"]) return @"Apple TV 2G";
if ([deviceString isEqualToString:@"AppleTV3,1"]) return @"Apple TV 3G";
if ([deviceString isEqualToString:@"AppleTV3,2"]) return @"Apple TV 3G";
if ([deviceString isEqualToString:@"AppleTV5,3"]) return @"Apple TV 4G";
return deviceString;
}
iOS 获取设备版本型号的更多相关文章
- iOS获取设备型号、装置类型等信息
iOS获取设备型号.设备类型等信息 设备标识 关于设备标识,历史上盛行过很多英雄,比如UDID.Mac地址.OpenUDID等,然而他们都陆陆续续倒在了苹果的门下.苹果目前提供了2个方法供App获取设 ...
- iOS获取设备型号和App版本号等信息(OC+Swift)
iOS获取设备型号和App版本号等信息(OC+Swift) 字数1687 阅读382 评论3 喜欢10 好久没有写过博客了,因为中间工作比较忙,然后有些个人事情所以耽误了.但是之前写的博客还一直有人来 ...
- iOS获取设备唯一标识的8种方法
8种iOS获取设备唯一标识的方法,希望对大家有用. UDID UDID(Unique Device Identifier),iOS 设备的唯一识别码,是一个40位十六进制序列(越狱的设备通过某些工具可 ...
- iOS获取设备型号、设备类型等信息
摘自 :http://www.mamicode.com/info-detail-1165460.html 设备标识 关于设备标识,历史上盛行过很多英雄,比如UDID.Mac地址.OpenUDID等,然 ...
- iOS 获取设备型号以及IP地址
首先导入四个头文件 #include <sys/types.h> #include <sys/sysctl.h> #include <ifaddrs.h> #inc ...
- iOS 获取设备唯一标示符的方法
在开发中会遇到应用需要记录设备标示,即使应用卸载后再安装也可重新识别的情况,在这写一种实现方式--读取设备的UUID(Universally Unique Identifier)并通过KeyChain ...
- ios获取设备信息总结
1.获取设备的信息 UIDevice *device = [[UIDevice alloc] int]; NSString *name = device.name; //获取设备所有者的名 ...
- iOS 获取设备信息,mac地址,IP地址,设备名称
#import "DeviceInfoUtil.h" #import "GlobleData.h" #import "sys/utsname.h&qu ...
- ios 获取设备相关的信息
.获取设备的信息 UIDevice *device = [[UIDevice alloc] int]; NSString *name = device.name; //获取设备所有者的名称 NSStr ...
随机推荐
- 扩展Exception,增加判断Exception是否为SQL引用约束异常方法!
在设计数据表时,如果将某些列设置为关联其它表的外键,那么如果对其进行增加.修改操作时,其关联表若没有相匹配的记录则报错,或者在对其关联表进行删除时,也会报错,这就是外键约束的作用,当然除了外键还有许多 ...
- IOS开发技巧快速生成二维码
随着移动互联网的发展,二维码应用非常普遍,各大商场,饭店,水果店 基本都有二维码的身影,那么ios中怎么生成二维码呢? 下面的的程序演示了快速生成二维码的方法: 在ios里面要生成二维码,需要借助一个 ...
- Maven提高篇系列之(六)——编写自己的Plugin(本系列完)
这是一个Maven提高篇的系列,包含有以下文章: Maven提高篇系列之(一)——多模块 vs 继承 Maven提高篇系列之(二)——配置Plugin到某个Phase(以Selenium集成测试为例) ...
- 【转载】Lucene.Net无障碍学习和使用:搜索篇
在上一篇中,我们初步理解了索引的增删改查基本操作.本文着重介绍一下常用的搜索,以及搜索结果的排序和分页.本文的搜索主要是基于前一篇介绍的文本文件的索引,建议下载最后改进的demo对照着看阅读本文,同时 ...
- asp.net(c#)将彩色图片变灰阶图片
代码如下: using System; using System.Collections; using System.Configuration; using System.Data; using S ...
- XE7 Update 1 选 iOS 8.1 SDK 发布 iPhone 3GS 实机测试
测试实机:iPhone 3GS(v6.1.2)其它机种也可以正常发布,方法以此类推 开发环境:Delphi XE7 Update 1(选择 iOS 8.1 SDK) 发布时需要到 Project &g ...
- [moka同学笔记]Yii2.0给一张表中增加一个属性
1.model中建立关联 public function getUser(){ return$this->hasOne(User::className(),['id'=>'uid']) ; ...
- 向量自回归模型VS风险价值模型(VAR&VaR)
单从外观上看,VAR&VaR两个模型很容易混淆,但就模型方法和用处两者截然不同,R语言作为数据分析的有力工具,其函数包库中包含各种各样的统计模型.通过vars包可以调用向量自回归模型,通过Pe ...
- mysql 导入text 到数据库
load data local infile 'f:/PhoneLocation_201601.327665.txt' into table sys_t_phone_area fields termi ...
- 解决WindowsServer 2008 R2 未注册版一个小时自动强制关机
仅用来学习交流,请大家购买正版,尊重正版版权. 安装了win2008R2,试了很多激活方法,终于激活后,不知道什么原因,过了一段时间后,每隔一段时间就自动关机,查了一下,发现是 wlms.exe在作祟 ...