2011年8月31日 星期三

IOS 取得系統執行環境(IPHONE/IPAD)

Use UIDevice-Extension written by Erica Sadun. A very comprehensive class: http://github.com/erica/uidevice-extension/blob/master/UIDevice-Hardware.m
 
 
系統資訊: 

[[UIDevice currentDevice] name]              // eg. "Brock's iPhone"
[[UIDevice currentDevice] model]             // eg. @"iPhone", @"iPod Touch"
[[UIDevice currentDevice] localizedModel]    // localized version of model
[[UIDevice currentDevice] systemName]        // eg. @"iPhone OS"
[[UIDevice currentDevice] systemVersion]     // eg. @"3.2"
[[UIDevice currentDevice] uniqueIdentifier]  // UDID, a unique string to identify the device

範例程式:
Each of the above lines will return an NSString. To which you can do a string comparison like so:

NSString *model = [[UIDevice currentDevice] model];
NSLog(@"Current device model: \"%@\"", model);



其他參考資訊


http://www.drobnik.com/touch/2009/07/determining-the-hardware-model/ You will need to modify this to use the right hardware number for the iPad. Taken from the link above:

沒有留言:

張貼留言