iOS应用内企业包更新下载

1、首先做好你的企业包。

2、编写plist文件,配置IPA地址(注意必须是https的服务器),并配置到https的服务器上。
如下图
iOS应用内企业包更新下载_第1张图片

plist文件




    
            items
            
                    
                            assets
                            
                                    
                                            kind
                                            software-package
                                            url
                                            https:********.ipa
                                            
                                    
                                            kind
                                            display-image
                                            needs-shine
                                            
                                            url
                                            AppIcon60x60%402x.png
                                    
                            
                            metadata
                            
                                    bundle-identifier
                                    com.*******
                                    bundle-version
                                    1.0
                                    kind
                                    software
                                    title
                                    ****
                            
                    
            
    

3.APP中请求plist文件,判断APP版本跳出弹窗提示更新。

	NSOperationQueue * queue = [[NSOperationQueue alloc] init];
	[queue addOperation:[NSBlockOperation blockOperationWithBlock:^{
	NSDictionary* dict = [NSDictionary dictionaryWithContentsOfURL:[NSURL URLWithString:@"这里填写你的plist文件地址"]];   
    if (dict) {
        NSString* newVersion = [[[[dict objectForKey:@"items"] objectAtIndex:0] objectForKey:@"metadata"] objectForKey:@"bundle-version"];
        NSString *myVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
        if (![newVersion isEqualToString:myVersion]) {
            UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"发现新版本,是否前往更新?" message:@"更新说明:....." preferredStyle:UIAlertControllerStyleAlert];
            [alertController addAction:[UIAlertAction actionWithTitle:@"不了" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {                  
            }]];  
            [alertController addAction:[UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-services://?action=download-manifest&url=你的plist文件地址"]];
            }]];
            [[UIApplication sharedApplication].delegate.window.rootViewController presentViewController:alertController animated:YES completion:nil];
        }
    }else{
        NSLog(@"您已经是最新版");
    }
}]];

4.本人使用的提示更新 ,你也可以强制更新。
可以做类似应用商店的效果。

你可能感兴趣的:(获取时间,iOSAPP企业包应用内更新)