iOS开发-Object-C获取手机设备信息(UIDevice)

一、获取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)

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值