ios 版本更新
来源:互联网 发布:视频传输软件 编辑:程序博客网 时间:2024/04/29 06:30
NSDictionary *infoDict = [[NSBundlemainBundle] infoDictionary];
NSString *currentVersion = [infoDictobjectForKey:@"CFBundleVersion"];
double doubleCurrentVersion = [currentVersiondoubleValue];
NSURLRequest *req = [NSURLRequestrequestWithURL:[NSURLURLWithString:@"http://itunes.apple.com/lookup?id=你的appid"]];
AFHTTPRequestOperation *request = [[AFHTTPRequestOperationalloc] initWithRequest:req];
[request setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation,id responseObject) {
NSString *str=[[NSStringalloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
NSDictionary *jsonData = [NSJSONSerializationJSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]options:NSJSONReadingMutableContainerserror:nil];
NSLog(@"%@",jsonData);
NSArray *infoArray = [jsonDataobjectForKey:@"results"];
if (infoArray.count!=0) {
NSDictionary *releaseInfo = [infoArrayobjectAtIndex:0];
NSString *latestVersion = [releaseInfoobjectForKey:@"version"];
NSString *trackViewUrl = [releaseInfoobjectForKey:@"trackViewUrl"];
_updateUrl = trackViewUrl;
double updateVersion = [latestVersiondoubleValue];
if (updateVersion > doubleCurrentVersion) {
UIAlertView *alertd = [[UIAlertViewalloc] initWithTitle:@"温馨提示"message:@"检测到有新版本,立即前往更新?"delegate:selfcancelButtonTitle:@"暂不更新"otherButtonTitles:@"立即前往",nil];
alertd.tag =110;
[alertd show];
}else
{
// [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:@"当前已是最新版本" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil] show];
}
}else{
// [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:@"当前已是最新版本" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil] show];
}
} failure:^(AFHTTPRequestOperation *operation,NSError *error) {
// [self errorActionWith:error];
}];
[request start];
}
- IOS版本检测,更新版本
- iOS 检测版本更新
- ios检查版本更新
- ios版本更新
- iOS 检测版本更新
- IOS检测版本更新
- IOS版本更新
- ios检查版本更新
- iOS检测版本更新
- iOS 检测版本更新
- ios版本更新
- iOS 版本更新
- iOS 检测版本更新
- IOS 版本更新检测
- iOS 检测版本更新
- iOS 检测版本更新
- iOS --检测更新版本
- IOS 版本检查更新
- 2090 算菜价
- 使用Android studio分析内存泄露
- java反射机制
- Linux内核中RAID5源码详解之写过程剖析(二)
- java ee 网页中图表的显示
- ios 版本更新
- 青蛙跳台阶
- 图像处理函数详解——padarray
- java 多线程------条件变量
- Java多线程
- hdu1969 pie【二分】
- LeetCode -- Three Sum
- Object-C NSURL
- UML学习