IOS企业版版本应用的更新下载不同于个人版本,无需访问应用商店进行更新。可使用插件iVersion检查版本更新。https://github.com/nicklockwood/iVersion。
引入插件后的App,首先访问配置的远程version.plist文件获取到最新的版本号和版本更新信息,然后会和本地的版本号作比较。如果本地版本号小于远程版本号,app会弹窗提示是否更新,即访问配置的远程下载地址,下载安装更新。
一、准备plist文件。文件名为:xxt.plist。放到服务器(http://xxxxx/xxt/IOS/xxt.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://xxxxx/xxt/IOS/XXX.ipa</string> </dict> <dict> <key>kind</key> <string>display-image</string> <key>url</key> <string>https://xxxxx/xxt/IOS/logo_57x57.png</string> </dict> <dict> <key>kind</key> <string>full-size-image</string> <key>url</key> <string>https://xxxxx/xxt/IOS/logo_512x512.png</string> </dict> </array> <key>metadata</key> <dict> <key>bundle-identifier</key> <string>com.xxxxx.xxx</string> <key>bundle-version</key> <string>1.0.5</string> <key>kind</key> <string>software</string> <key>title</key> <string>XXX</string> </dict> </dict> </array> </dict> </plist>二、XCode修改app版本信息
三、准备versions.plist文件。放到http://xxx.xx.com/ios/versions.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>1.0.5</key> <string>优化用户体验</string> </dict> </plist>四、客户端引入iVersion插件。
访问https://github.com/nicklockwood/iVersion/tree/master/iVersion,将该目录下的文件放置到项目的classes目录下 AppDelegate.m文件中didFinishLaunchingWithOptions方法中以下代码 iVersion *iv = [iVersion sharedInstance]; iv.updateURL = [NSURL URLWithString:@"itms-services://?action=download-manifest&url=https://XXX.XXXXX.com/achivements/XXX.plist"]; iv.remoteVersionsPlistURL = @"https://XXX.XXXXX.com/achivements/versions.plist"; iVersion.m中可修改弹框按钮的文本 - (NSString *)downloadButtonLabel { return _downloadButtonLabel ?: [self localizedStringForKey:iVersionDownloadButtonKey withDefault:@"现在安装"]; } - (NSString *)remindButtonLabel { return _remindButtonLabel ?: [self localizedStringForKey:iVersionRemindButtonKey withDefault:@"稍后提醒"]; }