国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

UIDevice獲取設備數據以及如何獲取應用信息

2019-11-14 19:38:41
字體:
來源:轉載
供稿:網友

在IOS的APP的應用開發的過程中,有時候需要自動收集用戶設備、系統信息、應用信息等等。 
比如在在app中加入收集用戶反饋功能,不僅用戶的反饋能夠提交到服務器,包括上述信息同時也自動提交到服務器。對用戶反饋bug特別有用。

 
下面是他們的獲取方法:
  1. //設備相關信息的獲取  
  2.     NSString *strName = [[UIDevice currentDevice] name];  
  3.     NSLog(@"設備名稱:%@", strName);  
  4.       
  5.     NSString *strId = [[UIDevice currentDevice] uniqueIdentifier];  
  6.     NSLog(@"設備唯一標識:%@", strId);  
  7.       
  8.     NSString *strSysName = [[UIDevice currentDevice] systemName];  
  9.     NSLog(@"系統名稱:%@h", strSysName);  
  10.       
  11.     NSString *strSysVersion = [[UIDevice currentDevice] systemVersion];  
  12.     NSLog(@"系統版本號:%@", strSysVersion);  
  13.       
  14.     NSString *strModel = [[UIDevice currentDevice] model];  
  15.     NSLog(@"設備模式:%@", strModel);  
  16.       
  17.     NSString *strLocModel = [[UIDevice currentDevice] localizedModel];  
  18.     NSLog(@"本地設備模式:%@", strLocModel);  
  19.       
  20.     float version = [[[UIDevice currentDevice] systemVersion] floatValue];  
  21.     NSLog(@"版本號:%f/n", version);  
  22.       
  23.     //app應用相關信息的獲取  
  24.     NSDictionary *dicInfo = [[NSBundle mainBundle] infoDictionary];  
  25. //    CFShow(dicInfo);  
  26.       
  27.     NSString *strAppName = [dicInfo objectForKey:@"CFBundleDisplayName"];  
  28.     NSLog(@"App應用名稱:%@", strAppName);  
  29.       
  30.     NSString *strAppVersion = [dicInfo objectForKey:@"CFBundleShortVersionString"];  
  31.     NSLog(@"App應用版本:%@", strAppVersion);  
  32.       
  33.     NSString *strAppBuild = [dicInfo objectForKey:@"CFBundleVersion"];  
  34.     NSLog(@"App應用Build版本:%@", strAppBuild);  

但是,在IOS5之后,原來獲取iphone的Device Id的接口:[[UIDevice currentDevice] uniqueIdentifier] 被廢棄了。
uinqueIdentifier在UIDevice.h中的定義如下:
  1. @PRoperty(nonatomic,readonly,retain) NSString    *uniqueIdentifier  NS_DEPRECATED_IOS(2_0, 5_0);  
  2. // a string unique to each device based on various hardware info.  
意思是iOS2.0以上及iOS5.0以下的系統可用,但不建議使用.Apple有可能在ios5.0之后刪除該函數. 
經過測試,未越獄的iPhone,系統版本為5.0.1,依然可以獲取UDID.。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 庐江县| 古交市| 渝中区| 灯塔市| 石台县| 彰化县| 南京市| 象山县| 永清县| 景泰县| 宝丰县| 苍南县| 赣榆县| 永寿县| 宁夏| 西乌| 额济纳旗| 天长市| 黔东| 织金县| 嘉峪关市| 三都| 台前县| 六安市| 乐山市| 濮阳县| 神池县| 马边| 绥芬河市| 射洪县| 图片| 京山县| 柏乡县| 永州市| 临潭县| 永平县| 木里| 油尖旺区| 苏尼特右旗| 上高县| 黑龙江省|