//1.获取本地版本号
NSString *key =@"CFBundleShortVersionString";
NSString *currentVersion = [NSBundlemainBundle].infoDictionary[key];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/lookup?id=%@", APPID]];
NSString * file = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];
if (file != nil) {
NSError *error;
NSDictionary *jsonStr = [NSJSONSerialization JSONObjectWithData:[file dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&error];
NSDictionary *results = [jsonStr[@"results"] hw_safeObjectAtIndex:0];
NSString *newVersion = [results hw_safeObjectForKey:@"version"];
// NSString *releaseNotes = [results hw_safeObjectForKey:@"releaseNotes"];
NSString *artistViewUrl = [results hw_safeObjectForKey:@"artistViewUrl"];
if( [nowVersion compare:newVersion options:NSNumericSearch]== -1)
{
新版本提示
}
}