iOS獲取裝置資訊的常用方法

weixin_33728268發表於2016-06-02

參考連結 : http://childhood.logdown.com/posts/208216/ios-access-device-information-summary-of-commonly-used-methods

//globallyUniqueString 唯一標示符,每次呼叫都會不一樣
[[NSProcessInfo processInfo] globallyUniqueString];
//作業系統名稱
[[NSProcessInfo processInfo] operatingSystemName];
//作業系統版本
[[NSProcessInfo processInfo] operatingSystemVersionString];

//實體記憶體
[[NSProcessInfo processInfo] physicalMemory];
//程式名稱
[[NSProcessInfo processInfo] processName];
//供應商標識
[[UIDevice currentDevice] identifierForVendor];

//裝置名稱
[[UIDevice currentDevice] userInterfaceIdiom];
//裝置型別
[[UIDevice currentDevice] name];
//系統名稱
[[UIDevice currentDevice] systemName];
//系統版本
[[UIDevice currentDevice] systemVersion];

//模型 iPad or iPhone
[[UIDevice currentDevice] model];
//本地化模型
[[UIDevice currentDevice] localizedModel];
//電池狀態
[[UIDevice currentDevice] batteryLevel];


//判斷設定是否是7.0以上版本
[[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f;

//判斷設定是否是iPhone 或者iPad TV
[[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;

[[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone;

[[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomTV;

相關文章