- (void)updateVersion
{
//appid 是上传IPA的ID APIToken 查看文档如何生成
NSString *idUrlString = @"http://api.fir.im/apps/latest/APPID?api_token=XXX";
NSURL *requestURL = [NSURL URLWithString:idUrlString];
NSURLRequest *request = [NSURLRequest requestWithURL:requestURL];
NSURLResponse *response = nil;
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil];
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
NSString *currentVersion = [infoDic objectForKey:@"CFBundleShortVersionString"];
NSDictionary *version = [dic objectForKey:@"versionShort"];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue currentQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
//在线版本与本地版本比较
if (version > currentVersion) {
//do something
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"版本有更新" message:[NSString stringWithFormat:@"检测到新版本(%@),是否更新?",version] delegate:self cancelButtonTitle:nil otherButtonTitles:@"更新",nil];
[alert show];
}else
{
}
}];
}
- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
//5实现跳转更新
if(buttonIndex==0)
{
//获取下载token 转码生成plist文件,完成下载跳转URL 直接openURL
NSString * urlString = @"https://download.fir.im/v2/app/install/APPID?download_token=XXX";
NSString *URLencodeString = CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)urlString, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding)));
NSString *installURL = [NSString stringWithFormat:@"itms-services://?action=download-manifest&url=%@", URLencodeString];
NSURL *openURL = [NSURL URLWithString:installURL];
[[UIApplication sharedApplication] openURL:openURL];
}
}
fir.im 上企业版IPA版本更新
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
相关阅读更多精彩内容
- 整个上传过程比较顺利,如果在上传过程中有遇到问题的童鞋请移步goole: 1.用xcode打好包 2.打开term...
- 一个半月前 加入天禅映画群 也是好奇零基础的同学可以在一两天能画出很美的画 这是一趟奇妙的旅程 起初,我们画都是这...