iOS Enterprise Edition automatically updates with third-party implementations

Source: Internet
Author: User

1. Get local version and Internet version

nsdictionary *infodictionary = [[nsbundle mainbundle] Infodictionary];

nsstring * localversion = [infodictionary objectforkey:@ " Cfbundleshortversionstring "];

nsstring * netversion = [nsstring stringwithformat:@ "%@" /c6>, paramdic[@ "clientversion"];

2, compare the local version and the Internet version, if there is the latest version, to download

3. Use of third party platform website Tools on the fir.im to enable Automatic Updates

3.1, query the platform to install the version

[nsstringstringwithformat:@ "http://api.fir.im/apps/%@/ download_token?api_token=%@ ", Idstr,token]

3.2, get the address of the direct installation

  NSString * DownloadURL =   [nsstringstringwithformat:@ "Https://download.fir.im/apps/%@/install? download_token=%@ ", Idstr,downloadtoken]

3.3, need to encode the address, and then to lowercase

nsstring *encodeurl = [DownloadURL Stringbyaddingpercentencodingwithallowedcharacters: [nscharacterset Urlhostallowedcharacterset]];

nsstring *url =[nsstring stringwithformat:@ " itms-services://?action=download-manifest&url=%@ ", [[Encodeurl Stringbyreplacingoccurrencesofstring:@ "="withstring:@ "%3d" ] [ lowercasestring]];

4. Download the latest version automatically

if ([[uiapplication sharedapplication] Canopenurl: [nsurl urlwithstring: url]]) {

[ [uiapplication sharedapplication]openURL: [Nsurl urlwithstring : url] Options : @{} Completionhandler : Nil ];   }

iOS Enterprise Edition automatically updates with third-party implementations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.