-(void) GetUpdate
{
NSString *nowversion = [[[NSBundle Mainbundle] infodictionary] objectforkey:@ "cfbundleversion"];
NSString * file = [NSString stringwithcontentsofurl:[nsurl urlwithstring:@ "http://itunes.apple.com/lookup?id=***"];
NSLog (file);
"Version": "1.0"
Nsrange substr = [File rangeofstring:@ "\" version\ ": \" "];
Nsrange substr2 =[file rangeofstring:@ "\" "Options:null range:nsrange{substr.location+substr.length,10}];
Nsrange range = {Substr.location+substr.length,substr2.location-substr.location-substr.length};
NSString *newversion =[file Substringwithrange:range];
if ([Nowversion isequaltostring:newversion]==no)
{
Uialertview *alert = [[Uialertview alloc]initwithtitle:nil message:@ "version has update" Delegate:self cancelbuttontitle:@ "Cancel" otherbuttontitles:@ "Update", nil];
[Alert show];
}
}
-(void) Alertview: (Uialertview *) Alertview Clickedbuttonatindex: (Nsinteger) Buttonindex
{
if (buttonindex==1)
{
Nsurl *url = [Nsurl urlwithstring:@ "https://itunes.apple.com/us/app/qun-xiang-dao/id***?ls=1&mt=8"];
[[UIApplication Sharedapplication]openurl:url];
}
}
iOS version update