且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何通过无线方式更新ios6企业应用程序

更新时间:2023-01-01 17:43:31

是的,这是可能的。部署企业应用程序时,它需要包含有关应用程序元数据的plist。此元数据包括可用于检查更新的版本号。

Yes, it is possible. When you deploy an Enterprise application it requires a plist that contains metadata about the application. This metadata includes the version number that you can use to check for updates.

BOOL updateAvailable = NO;
NSDictionary *updateDictionary = [NSDictionary dictionaryWithContentsOfURL:
                                  [NSURL URLWithString:@"http://www.example.com/pathToPlist"]];

if(updateDictionary)
{
    NSArray *items = [updateDictionary objectForKey:@"items"];
    NSDictionary *itemDict = [items lastObject];

    NSDictionary *metaData = [itemDict objectForKey:@"metadata"];
    NSString *newversion = [metaData valueForKey:@"bundle-version"];
    NSString *currentversion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];

    updateAvailable = [newversion compare:currentversion options:NSNumericSearch] == NSOrderedDescending;
}

一旦检测到更新可用,请将用户导航到下载URL

Once you detect the update is available navigate the user to the download URL


itms-services://?action = download-manifest& url =< url-path-to-plist&gt ;

它将安装在现有版本上,保留所有数据,甚至升级CoreData数据库,如果您设置自动迁移并进行更改。

and it will install over the existing version leaving all data in-tact and even upgrade the CoreData database if you setup auto migration and make changes.