国产探花免费观看_亚洲丰满少妇自慰呻吟_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.。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 都兰县| 平江县| 南皮县| 桐柏县| 文水县| 锡林郭勒盟| 施秉县| 云林县| 绿春县| 讷河市| 保靖县| 靖远县| 大余县| 临桂县| 广元市| 安岳县| 灵宝市| 永和县| 山东| 渝北区| 黑龙江省| 杭锦后旗| 通渭县| 金溪县| 罗江县| 南投县| 梧州市| 昭平县| 芜湖县| 壤塘县| 城口县| 玉屏| 高平市| 新民市| 开原市| 新邵县| 疏附县| 梨树县| 平湖市| 汶上县| 西昌市|