APP Store Upgrade Issues

Source: Internet
Author: User

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {

NSString *url = [[NSString alloc] initwithformat:@ "http://itunes.apple.com/lookup?id=%@", @ "1087624011"];

NSLog (@ "---------%@", url);

[Self postpath:url];

return YES;

}

-(void) Postpath: (NSString *) path

{

Nsurl *url = [Nsurl Urlwithstring:path];

Nsmutableurlrequest *request = [Nsmutableurlrequest requestwithurl:url

Cachepolicy:nsurlrequestreloadignoringcachedata

TIMEOUTINTERVAL:10];

[Request sethttpmethod:@ "POST"];

Nsoperationqueue *queue = [Nsoperationqueue new];

[Nsurlconnection sendasynchronousrequest:request queue:queue completionhandler:^ (NSURLResponse *response,NSData * Data,nserror *error) {

Nsmutabledictionary *receivestatusdic=[[nsmutabledictionary Alloc]init];

if (data) {

Nsdictionary *receivedic = [nsjsonserialization jsonobjectwithdata:data options:nsjsonreadingmutableleaves Error:nil ];

if ([[Receivedic valueforkey:@ "Resultcount"] intvalue]>0) {

[Receivestatusdic setvalue:@ "1" forkey:@ "status"];

[Receivestatusdic setvalue:[[[receivedic valueforkey:@ "results"] objectatindex:0] valueforkey:@ "version"] forKey:@ " Version "];

}else{

[Receivestatusdic setvalue:@ "-1" forkey:@ "status"];

}

}else{

[Receivestatusdic setvalue:@ "-1" forkey:@ "status"];

}

[Self Performselectoronmainthread: @selector (receivedata:) withobject:receivestatusdic Waituntildone:no];

}];

}

-(void) Receivedata: (ID) sender

{

Nsdictionary *infodictionary = [[NSBundle mainbundle] infodictionary];

NSString *app_version = [infodictionary objectforkey:@ "cfbundleshortversionstring"];

Nsdictionary *dictionary = (nsdictionary *) sender;

if ([[Dictionary objectforkey:@ "version"]doublevalue]>[app_version Doublevalue]) {

Uialertview *alert = [[Uialertview alloc]initwithtitle:@] Warm tip "message:@" Your current app version is too low, please upgrade "Delegate:nil cancelbuttontitle:@ "OK" otherbuttontitles:nil, nil];

[Alert show];

NSString *url = @ "https://itunes.apple.com/cn/app/he-ge-zheng-guan-li/id1087624011?mt=8";

[[UIApplication Sharedapplication]openurl:[nsurl Urlwithstring:url]];

}

}

V

APP Store Upgrade Issues

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.