-(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