下面是他們的擷取方法:
//裝置相關資訊的擷取
nsstring *strname = [[uidevice currentdevice] name];
nslog(@"裝置名稱:%@", strname);
nsstring *strid = [[uidevice currentdevice] uniqueidentifier];
nslog(@"裝置唯一辨別:%@", strid);
nsstring *strsysname = [[uidevice currentdevice] systemname];
nslog(@"系統名稱:%@", strsysname);
nsstring *strsysversion = [[uidevice currentdevice] systemversion];
nslog(@"系統版本号:%@", strsysversion);
nsstring *strmodel = [[uidevice currentdevice] model];
nslog(@"裝置模式:%@", strmodel);
nsstring *strlocmodel = [[uidevice currentdevice] localizedmodel];
nslog(@"本地裝置模式:%@", strlocmodel);
float version = [[[uidevice currentdevice] systemversion] floatvalue];
nslog(@"版本号:%f\n", version);
//app應用相關資訊的擷取
nsdictionary *dicinfo = [[nsbundle mainbundle] infodictionary];
// cfshow(dicinfo);
nsstring *strappname = [dicinfo objectforkey:@"cfbundledisplayname"];
nslog(@"app應用名稱:%@", strappname);
nsstring *strappversion = [dicinfo objectforkey:@"cfbundleshortversionstring"];
nslog(@"app應用版本:%@", strappversion);
nsstring *strappbuild = [dicinfo objectforkey:@"cfbundleversion"];
nslog(@"app應用build版本:%@", strappbuild);
但是,在ios5之後,原來擷取iphone的device id的接口:[[uidevice currentdevice] uniqueidentifier] 被廢棄了。
uinqueidentifier在uidevice.h中的定義如下:
@property(nonatomic,readonly,retain) nsstring *uniqueidentifier ns_deprecated_ios(2_0, 5_0);
// a string unique to each device based on various hardware info.
意思是ios2.0以上及ios5.0以下的系統可用,但不建議使用.apple有可能在ios5.0之後删除該函數.
經過測試,未越獄的iphone,系統版本為5.0.1,依然可以擷取udid.。
關于他的代替方法可以參考
http://stackoverflow.com/questions/6993325/uidevice-uniqueidentifier-deprecated-what-to-do-now
http://www.cocoachina.com/bbs/read.php?tid=92404
http://www.cnblogs.com/wgw8299/articles/2417579.html