// 當(dāng)前app的信息
NSDictionary?*infoDictionary?=?[[NSBundle?mainBundle]?infoDictionary];??
?CFShow(infoDictionary);??
//?app名稱
NSString?*app_Name?=?[infoDictionary?objectForKey:@"CFBundleDisplayName"];
//?app版本
NSString?*app_Version?=?[infoDictionary?objectForKey:@"CFBundleShortVersionString"];
//?app?build版本
NSString?*app_build?=?[infoDictionary?objectForKey:@"CFBundleVersion"];
//手機(jī)別名:?用戶定義的名稱
????NSString*?userPhoneName?=?[[UIDevice?currentDevice]?name];??
NSLog(@"手機(jī)別名:?%@",?userPhoneName);
//設(shè)備名稱
????NSString*?deviceName?=?[[UIDevice?currentDevice]?systemName];??
NSLog(@"設(shè)備名稱:?%@",deviceName?);
//手機(jī)系統(tǒng)版本
????NSString*?phoneVersion?=?[[UIDevice?currentDevice]?systemVersion];??
NSLog(@"手機(jī)系統(tǒng)版本:?%@",?phoneVersion);
//手機(jī)型號(hào)
????NSString*?phoneModel?=?[[UIDevice?currentDevice]?model];??
NSLog(@"手機(jī)型號(hào):?%@",phoneModel?);
//地方型號(hào)??(國(guó)際化區(qū)域名稱)
????NSString*?localPhoneModel?=?[[UIDevice?currentDevice]?localizedModel];??
NSLog(@"國(guó)際化區(qū)域名稱:?%@",localPhoneModel?);
????NSDictionary?*infoDictionary?=?[[NSBundle?mainBundle]?infoDictionary];??
//?當(dāng)前應(yīng)用名稱
NSString?*appCurName?=?[infoDictionary?objectForKey:@"CFBundleDisplayName"];
NSLog(@"當(dāng)前應(yīng)用名稱:%@",appCurName);
//?當(dāng)前應(yīng)用軟件版本??比如:1.0.1
NSString?*appCurVersion?=?[infoDictionary?objectForKey:@"CFBundleShortVersionString"];
NSLog(@"當(dāng)前應(yīng)用軟件版本:%@",appCurVersion);
//?當(dāng)前應(yīng)用版本號(hào)碼???int類型
NSString?*appCurVersionNum?=?[infoDictionary?objectForKey:@"CFBundleVersion"];
NSLog(@"當(dāng)前應(yīng)用版本號(hào)碼:%@",appCurVersionNum);
//獲取APPStore里面的版本號(hào), 可以與本地的版本號(hào)作比較,判斷是否有新版本更新......
NSString *urlString=@"http://itunes.apple.com/lookup?id=1295166"; //自己應(yīng)用在App Store里的地址
NSURL *url = [NSURL URLWithString:urlString];//這個(gè)URL地址是該app在iTunes connect里面的相關(guān)配置信息心墅。其中id是該app在app store唯一的ID編號(hào)咽白。
NSString *jsonResponseString = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];
NSData *data = [jsonResponseString dataUsingEncoding:NSUTF8StringEncoding];
//? ? 解析json數(shù)據(jù)
id json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
NSArray *array = json[@"results"];
for (NSDictionary *dic in array) {
? ?NSString *? newVersion = [dic valueForKey:@"version"]; // appStore 的版本號(hào)
}