iOS开发-Object-C获取手机设备信息(UIDevice)
2015-07-27 10:50
405 查看
一、获取UiDevice设备信息
二、获取Bundle的相关信息
NSLocal获取本地化数据:
IOS开发-Swift获取手机设备信息(UIDevice)
// 获取设备名称 NSString *name = [[UIDevice currentDevice] name]; // 获取设备系统名称 NSString *systemName = [[UIDevice currentDevice] systemName]; // 获取系统版本 NSString *systemVersion = [[UIDevice currentDevice] systemVersion]; // 获取设备模型 NSString *model = [[UIDevice currentDevice] model]; // 获取设备本地模型 NSString *localizedModel = [[UIDevice currentDevice] localizedModel];
二、获取Bundle的相关信息
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary]; // app名称 NSString *appName = infoDict[@"CFBundleName"]; // app版本 NSString *appVersion = infoDict[@"CFBundleShortVersionString"]; // app build版本 NSString *appBuild = infoDict[@"CFBundleVersion"];
NSLocal获取本地化数据:
// 获取用户的语言偏好设置列表 NSLog(@"%@", [NSLocale preferredLanguages]); // 获取系统所有本地化标识符数组列表 NSLog(@"%@", [NSLocale availableLocaleIdentifiers]); // 获取所有已知合法的国家代码数组列表 NSLog(@"%@", [NSLocale ISOCountryCodes]); // 获取所有已知合法的ISO货币代码数组列表 NSLog(@"%@", [NSLocale ISOCurrencyCodes]); // 获取所有已知合法的ISO语言代码数组列表 NSLog(@"%@", [NSLocale ISOLanguageCodes]); // 获取当前系统设置语言的标识符 // 方法一 NSLog(@"%@", [[NSLocale currentLocale] localeIdentifier]); // 方法二 NSLog(@"%@", [[NSLocale currentLocale] objectForKey:NSLocaleIdentifier]);
IOS开发-Swift获取手机设备信息(UIDevice)
相关文章推荐
- iOS开发-Object-C学习之结构体使用
- Object c中的alloc和init问题
- Google Objective-C 风格指南
- Objective-C——Protocol
- Objective-C——Category
- cvHaarDetectObjects、cvRectangle
- OC面向对象
- GLib-GObject-WARNING **: Two different plugins tried to register
- Objective-c和Java下DES加密解密保持一致
- iPhone开发:Objective-c中@property声明时的参数释疑
- IOS-Swift、Objective-C、C++混合编程
- java.lang.NoClassDefFoundError: org/objectweb/asm/Type
- 反序列化JSON字符串 &遍历JObject
- Objective-C Properties 详解
- Objective-C设计模式——中介者Mediator(对象去耦)
- 第一条:了解Objective-C语言的起源
- Objective-C反射机制
- Objective-C通过联合存储为类增加属性及原理解析
- [转载] Objectiv-C 入门一二三
- Objective-C设计模式——外观Faced(接口适配)