iOS|iOS 获取本机的设备信息UIDevice
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
推荐阅读
- 2020-04-07vue中Axios的封装和API接口的管理
- iOS中的Block
- 记录iOS生成分享图片的一些问题,根据UIView生成固定尺寸的分享图片
- EditText默认不获取焦点弹出键盘
- 2019-08-29|2019-08-29 iOS13适配那点事
- Hacking|Hacking with iOS: SwiftUI Edition - SnowSeeker 项目(一)
- iOS面试题--基础
- whlie循环和for循环的应用
- 接口|axios接口报错-参数类型错误解决
- iOS|iOS 笔记之_时间戳 + DES 加密