iOS自检更新

第一种实现方法

#######define APP_URL @"http://itunes.apple.com/lookup?id=你程序的appId"会得到以下返回数据:

resultCount = 1;
    results =     (
                {
            advisories =             (
                "Infrequent/Mild Medical/Treatment Information"
            );
            appletvScreenshotUrls =             (
            );
            artistId = XXXXXX;
            artistName = “XXXXXXX Mobile Co.,Ltd.";
            artistViewUrl = "https://itunes.apple.com/us/developer/…”;
            artworkUrl100 = "http://is4.mzstatic.com/image/thumb/.../source/100x100bb.jpg";
            artworkUrl512 = "http://is4.mzstatic.com/image/thumb/.../source/512x512bb.jpg";
            artworkUrl60 = "http://is4.mzstatic.com/image/thumb/.../source/60x60bb.jpg";
            bundleId = "com.XXXX.XXXX”;
            contentAdvisoryRating = "12+";
            currency = USD;
            currentVersionReleaseDate = "2017-02-15T08:55:19Z";
            description = “app描述”;
            features =             (
            );
            fileSizeBytes = 189846528;
            formattedPrice = Free;
            genreIds =             (
                6015,
                6012
            );
            genres =             (
                Finance,
                Lifestyle
            );
            ipadScreenshotUrls =             (
            );
            isGameCenterEnabled = 0;
            isVppDeviceBasedLicensingEnabled = 1;
            kind = software;
            languageCodesISO2A =             (
                EN,
                ZH
            );
            minimumOsVersion = "7.0";
            price = 0;
            primaryGenreId = 6015;
            primaryGenreName = Finance;
            releaseDate = "2014-12-25T08:00:00Z";
            releaseNotes = "1.\U4fee\U590d\U9996\U9875\U5c55\U793a\U95ee\U9898\n2.\U4fee\U590d\U5fae\U4fe1\U8df3\U8f6cbug";
            screenshotUrls =             (
                "http://a2.mzstatic.com/.../screen696x696.jpeg",
                
            );
            sellerName = “XXXXX Mobile Co.,Ltd.";
            sellerUrl = "http://www.XXXXX.com";
            supportedDevices =             (
                "iPhone4-iPhone4",
                  "iPhone7Plus-iPhone7Plus"
            );
            trackCensoredName = “XXXXXX”;
            trackContentRating = "12+";
            trackId = XXXXXXXX;
            trackName = “XXXXXX”;
            trackViewUrl = "https://itunes.apple.com/us/app/...?mt=8&uo=4";
            version = "3.3901";
            wrapperType = software;
        }
    );
}

version 对应info.plist文件里的“Bundle versions string, short”字段是在appstore上的。
“Bundle version”字段,是调试版本号,不是显示在appstore上面。

获取appstore最新的版本号

NSString *appVersion = [infoDic objectForKey:@"version"];

取得本地程序的版本号
             NSString *localVersion =[localDic objectForKey:@"CFBundleShortVersionString"];

通过比较决定是否版本更新。

第二种实现方法是服务器给客户端提供接口,告知版本号在做比较,但多收上线时间影像,实现方法开发方自定,不再赘述。

你可能感兴趣的:(iOS自检更新)