#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 ...
随机推荐
-
理解js中的闭包
闭包 我的理解是 能够有权访问另一个函数作用域中变量的函数 通常我们知道 普通的函数在调用完成之后,活动对象不会从内存中销毁,其执行环境的作用域链会被销毁,造成资源的浪费 而闭包的好处就在于执行完就会 ...
-
Python学习的一些好资料
教程: 1. 廖雪峰的Python教程:http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a0 ...
-
Eclipse调试的一些小技巧
不要使用System.out.println作为调试工具 启用所有组件的详细的日志记录级别 使用一个日志分析器来阅读日志 1.条件断点 想象一下我们平时如何添加断点,通常的做法是双击行号的左边.在de ...
-
casperjs配合phantomjs实现自动登录百度,模拟点击等等操作 - 怕虎在线www.ipahoo.com图文教程 - 怕虎在线
微信支付取消2万元保证金门槛,这是全民电商来袭!-观点-虎嗅网 微信支付取消2万元保证金门槛,这是全民电商来袭! casperjs配合phantomjs实现自动登录百度,模拟点击等等操作 - 怕虎在线 ...
-
Java的基础知识三
一.Java 集合框架 集合框架是一个用来代表和操纵集合的统一架构.所有的集合框架都包含如下内容: 接口:是代表集合的抽象数据类型.接口允许集合独立操纵其代表的细节.在面向对象的语言,接口通常形成一个 ...
-
不能再忽视了!宝宝不肯吃粥的N个原因,你避免了几个?
辅食不懂怎么添加? 宝宝吃饭爱挑食? 营养均衡和多样化的辅食 在这里你都能找到 宝宝辅食微课堂 不能再忽视了!宝宝不肯吃粥的N个原因,你避免了几个? 2017-10-09 09:35 辅食不懂怎么添加 ...
-
AngularJS 笔记2
2017-03-23 本文更新链接: http://www.cnblogs.com/daysme/p/6613071.html $http angularjs中的ajax 向服务器请求数据 1/2 后 ...
-
c# WndProc事件 消息类型
转载:https://www.cnblogs.com/idben/p/3783997.html WM_NULL = 0x0000; WM_CREATE = 0x0001;应用程序创建一个窗口 WM_D ...
-
小学四则运算APP 第一个冲刺阶段 第三天
团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布是在与团队成员解决了昨天问题的基础上,再增加了几个界面,增加了一些功能,修改与增加的代 ...
-
WPF使用System.Windows.SystemParameters类获得屏幕分辨率
转自 http://hi.baidu.com/shirley_cst/item/a55c290c8aa2ee2ca0312da3 示例代码如下所示. double x = SystemParamete ...