iOS应用内企业包更新下载

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_43299553/article/details/83184485
1、首先做好你的企业包。

2、编写plist文件,配置IPA地址(注意必须是https的服务器),并配置到https的服务器上。
如下图
在这里插入图片描述

plist文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
            <key>items</key>
            <array>
                    <dict>
                            <key>assets</key>
                            <array>
                                    <dict>
                                            <key>kind</key>
                                            <string>software-package</string>
                                            <key>url</key>
                                            <string>https:********.ipa</string>
                                            </dict>
                                    <dict>
                                            <key>kind</key>
                                            <string>display-image</string>
                                            <key>needs-shine</key>
                                            <true/>
                                            <key>url</key>
                                            <string>AppIcon60x60%402x.png</string>
                                    </dict>
                            </array>
                            <key>metadata</key>
                            <dict>
                                    <key>bundle-identifier</key>
                                    <string>com.*******</string>
                                    <key>bundle-version</key>
                                    <string>1.0</string>
                                    <key>kind</key>
                                    <string>software</string>
                                    <key>title</key>
                                    <string>****</string>
                            </dict>
                    </dict>
            </array>
    </dict>

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.本人使用的提示更新 ,你也可以强制更新。
可以做类似应用商店的效果。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值