?Object-C获取手机设备信息
2015-06-01 15:56
513 查看
一、获取UiDevice设备信息
二、获取Bundle的相关信息
NSLocal获取本地化数据:
// 获取设备名称 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]);
相关文章推荐
- Swift 与 Object-C 交互 (Swift版本为:1.2)
- iOS开发(Objective-C)常用库索引
- objective-c第十六章练习题
- var object dynamic的区别
- Object sharing for Runnable vs. extends Thread
- Objective-C的内省(Introspection)机制
- Objective-C Autorelease Pool 的实现原理
- 说说MFC中CRuntimeClass和CObject之间的那点事
- 关于OC中消息转发机制的理解以及在项目中的实际应用
- Objective-C Runtime Programming Guide
- quartus II 报错(Error (10839): Verilog HDL error at sdram_params.v(30): declaring global objects is a)
- OC中的宏定义
- IOS基础:Objective-C 字符串处理
- objective c 的performSelector 与block
- .NET平台开源项目速览(2)Compare .NET Objects对象比较组件
- [Objective-C] 003_内存管理
- objective-c runtime安全措施之二:反注入
- 黑马程序员-面向对象的理解以及Objective-C方法和对象分配内存的学习笔记
- 《Effective Objective-C 2.0》4、Objective-C类的属性
- JAVA 一个特殊的类 Object