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)

 

posted @   GarveyCalvin  阅读(3469)  评论(0编辑  收藏  举报
编辑推荐:
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 如何使用 Uni-app 实现视频聊天(源码,支持安卓、iOS)
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
点击右上角即可分享
微信分享提示