首页 > 代码库 > App上架版本号配置的注意事项:CFBundleVersion与CFBundleShortVersionString设置,以及内部检查版本更新的代码

App上架版本号配置的注意事项:CFBundleVersion与CFBundleShortVersionString设置,以及内部检查版本更新的代码

一、CFBundleVersion与CFBundleShortVersionString设置

CFBundleVersion:标识内部版本号,如果发包错误时可以将错误的撤回及时更改内部版本号即可。

CFBundleShortVersionString:代表应用的发布版本号,该版本的版本号是三个时期分隔的整数组成的字符串。第一个整数代表重大修改的版本,如实现新的功能或重大变化的修订。第二个整数表示的修订,实现较突出的特点。第三个整数代表维护版本。

技术分享

如上图:Version对应的就是CFBundleShortVersionString 发布版本号 如当前上架版本为1.0.0  之后你更新的时候可以改为1.0.1)

           Build 对应的就是CFBundleVersion  (内部版本号,用以记录开发版本的,每次更新的时候都需要比上一次高 如:当前版本是1.0.1.1 ,下次可以改为:1.0.1.2)

 二、内部检查版本更新
由以上配置信息可知,要检查版本更新需对比当前的版本和请求返回的版本号,如果不一样才更新,如果一样则不更新;代码如下:
技术分享
 
请求以上代码中的url网址时,jsonDic字典中的数据如下:
{    resultCount = 1;    results =     (                {            advisories =             (                "Infrequent/Mild Medical/Treatment Information",                "Infrequent/Mild Alcohol, Tobacco, or Drug Use or References",                "Infrequent/Mild Mature/Suggestive Themes"            );            artistId = 948095456;            artistName = "\U6cf0\U5408\U9f0e\U5ddd\U7269\U8054\U79d1\U6280(\U5317\U4eac)\U80a1\U4efd\U6709\U9650\U516c\U53f8";            artistViewUrl = "https://itunes.apple.com/us/artist/tai-he-ding-chuan-wu-lian/id948095456?uo=4";            artworkUrl100 = "http://a1369.phobos.apple.com/us/r30/Purple5/v4/d9/38/b4/d938b4a8-eafe-1df9-456c-3e6c4486b512/pr_source.png?downloadKey=1420349088_27bb179ca36585e709f3d0e15125b72c";            artworkUrl512 = "http://a1369.phobos.apple.com/us/r30/Purple5/v4/d9/38/b4/d938b4a8-eafe-1df9-456c-3e6c4486b512/pr_source.png?downloadKey=1420349088_27bb179ca36585e709f3d0e15125b72c";            artworkUrl60 = "http://a839.phobos.apple.com/us/r30/Purple3/v4/ae/3a/96/ae3a96e6-4c1e-4f74-57e1-bd331a03fc06/AppIcon60x60_U00402x.png";            bundleId = "com.dcwl.vjifen";            contentAdvisoryRating = "12+";            currency = USD;            description = "\U3010V\U79ef\U5206 - \U8d85\U5e02\U8fd4\U5229\U795e\U5668\U3011\n\U6d77\U91cf\U751f\U6d3b\U5fc5\U5907\U5546\U54c1\Uff0c\U8d85\U5e02\U8d2d\U7269\U8f7b\U677e\U8fd4\U5229\Uff08\U4e0d\U9650\U8d85\U5e02\U54e6\Uff09\n\U4e0a\U4f20\U8d85\U5e02\U8d2d\U7269\U5c0f\U7968\U6216\U5bf9\U8fd4\U5229\U5546\U54c1\U626b\U7801\Uff0c\U8f7b\U677e\U5f97\U5230\U8fd4\U5229\Uff01\n\U77ac\U95f4\U53d8\U201c\U8bdd\U8d39/\U73b0\U91d1\U201d\Uff0c\U6bcf\U6708\U767d\U62ff\U51e0\U5341\U5143\Uff01\n\U4f7f\U7528\U201cV\U79ef\U5206\U201d\U806a\U660e\U8d2d\U7269\U61c2\U751f\U6d3b\Uff0c\U66f4\U591a\U60ca\U559c\U7ed9\U5230\U4f60......\n\n\n\U3010\U5173\U4e8eV\U79ef\U5206\U3011\n\U56fd\U5185\U9996\U5bb6\U4e3b\U4f53\U57fa\U4e8e\U7ebf\U4e0b\U8d2d\U7269\U6a21\U5f0f\U7684\U8fd4\U5229\U5e73\U53f0\n\U5168\U56fd\U5404\U5927\U54c1\U8d28\U7c7b\U8d85\U5e02\U3001\U4fbf\U5229\U5e97\U7b49\U5747\U53c2\U4e0e\U8fd4\U5229\n\U6d77\U91cf\U89c4\U6a21\U8fd4\U5229\U5546\U54c1\U5168\U8986\U76d6\Uff0c\U671f\U671f\U6709\U60ca\U559c......\n\n\U3010\U8054\U7cfb\U6211\U4eec\U3011\n\U5fae\U4fe1\U516c\U4f17\U8d26\U53f7\Uff1aVjifenCN\n\U5ba2\U670d\U7535\U8bdd\Uff1a4008-365-591\n\U7f51\U5740\Uff1awww.vjifen.com\n\n\n\U300eVjifen \U00b7 \U6211\U4eec\U4e00\U76f4\U5728\U52aa\U529b\Uff0c\U4e3a\U60a8\U4e89\U53d6\U5230\U66f4\U591a\Uff01\U300f";            features =             (            );            fileSizeBytes = 9477488;            formattedPrice = Free;            genreIds =             (                6012,                6002            );            genres =             (                Lifestyle,                Utilities            );            ipadScreenshotUrls =             (            );            isGameCenterEnabled = 0;            kind = software;            languageCodesISO2A =             (                EN,                ZH            );            minimumOsVersion = "7.0";            price = 0;            primaryGenreId = 6012;            primaryGenreName = Lifestyle;            releaseDate = "2014-12-17T09:30:15Z";            screenshotUrls =             (                "http://a2.mzstatic.com/us/r30/Purple1/v4/f1/cc/dd/f1ccddd5-854f-7c24-0b97-57d465629a9d/screen1136x1136.jpeg",                "http://a5.mzstatic.com/us/r30/Purple3/v4/9b/72/ff/9b72ff20-66dd-ae30-c4b0-f2fe46822dd4/screen1136x1136.jpeg",                "http://a5.mzstatic.com/us/r30/Purple1/v4/c6/50/40/c6504046-04f7-ea6d-3d85-7d5e17a99faa/screen1136x1136.jpeg",                "http://a2.mzstatic.com/us/r30/Purple5/v4/13/36/50/1336501d-b688-93ee-8c13-bbd56910c326/screen1136x1136.jpeg",                "http://a3.mzstatic.com/us/r30/Purple3/v4/86/37/d5/8637d51c-cdd0-8528-48da-4d3b40037e4c/screen1136x1136.jpeg"            );            sellerName = "TaiHe DingLink Technology Inc";            supportedDevices =             (                iPadThirdGen4G,                iPhone4,                iPodTouchFifthGen,                iPhone5s,                iPadMini4G,                iPad2Wifi,                iPadFourthGen,                iPadMini,                iPadThirdGen,                iPhone5,                iPadFourthGen4G,                iPad23G,                iPhone4S,                iPhone5c            );            trackCensoredName = "V\U79ef\U5206 - \U8d85\U5e02\U8fd4\U5229\U795e\U5668\U3010\U6d77\U91cf\U8d85\U5e02\U5546\U54c1\Uff0c\U8d2d\U7269\U8f7b\U677e\U8fd4\U5229\U3011";            trackContentRating = "12+";            trackId = 948095457;            trackName = "V\U79ef\U5206 - \U8d85\U5e02\U8fd4\U5229\U795e\U5668\U3010\U6d77\U91cf\U8d85\U5e02\U5546\U54c1\Uff0c\U8d2d\U7269\U8f7b\U677e\U8fd4\U5229\U3011";            trackViewUrl = "https://itunes.apple.com/us/app/v-ji-fen-chao-shi-fan-li-shen/id948095457?mt=8&uo=4";            version = "1.0.0";            wrapperType = software;        }    );}

最后强调一点切记:当从网络接口获取的版本号和本地的版本号对照的时候一定要使用:CFBundleShortVersionString,不然会造成错误的。。

 

            

 

App上架版本号配置的注意事项:CFBundleVersion与CFBundleShortVersionString设置,以及内部检查版本更新的代码