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)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM