美文网首页
iOS 获取本机的设备信息UIDevice

iOS 获取本机的设备信息UIDevice

作者: Joker_King | 来源:发表于2016-06-03 20:30 被阅读684次

UIDevice

//使用类方法来获取当前的设备
UIDevice *myDecive = [UIDevice currentDevice];
//设备名称
NSLog(@"name-------%@",myDecive.name);
//设备模式
NSLog(@"model--------%@",myDecive.model);
//设备的本地模式
NSLog(@"localizedModel---------%@",myDecive.localizedModel);
//系统的名称
NSLog(@"systemName--------%@",myDecive.systemName);
//系统版本
NSLog(@"systemVersion---------%@",myDecive.systemVersion);
//设备的朝向
NSLog(@"orientation---------%ld",(long)myDecive.orientation);
//设备的uuid,使用NSUUID来将获取的uuid转换成字符串,以便于我们后期使用
NSLog(@"identifierForVendor---%@",myDecive.identifierForVendor.UUIDString);
//当前设备是否有转向通知
NSLog(@"%d",myDecive.isGeneratingDeviceOrientationNotifications);
//电池的状态
NSLog(@"batteryState-----%ld",(long)myDecive.batteryState);
//电量的百分比
NSLog(@"batteryLevel--------+%f",myDecive.batteryLevel);

控制台输出的信息

2016-06-03 20:29:52.646 UIDevice[40489:442865] name-------iPhone Simulator
2016-06-03 20:29:52.646 UIDevice[40489:442865] model--------iPhone
2016-06-03 20:29:52.647 UIDevice[40489:442865] localizedModel---------iPhone
2016-06-03 20:29:52.647 UIDevice[40489:442865] systemName--------iPhone OS
2016-06-03 20:29:52.648 UIDevice[40489:442865] systemVersion---------9.2
2016-06-03 20:29:52.648 UIDevice[40489:442865] orientation---------0
2016-06-03 20:29:52.649 UIDevice[40489:442865] identifierForVendor---FAB6E912-40B7-465B-8C62-A8EFDED7462B
2016-06-03 20:29:52.649 UIDevice[40489:442865] 1
2016-06-03 20:29:52.649 UIDevice[40489:442865] batteryState-----0
2016-06-03 20:29:52.649 UIDevice[40489:442865] batteryLevel--------+-1.000000

相关文章

网友评论

      本文标题:iOS 获取本机的设备信息UIDevice

      本文链接:https://www.haomeiwen.com/subject/ehkldttx.html