大佬教程收集整理的这篇文章主要介绍了ios – 应用更新通知的文档,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
- (void) checkForupdates { NSString *jsonUrl = @"http://itunes.apple.com/search?term=yourAppName&entity=software&limit=1"; NSData *jsonData = [NSData dataWithContentsOfURL:[NSURL URLWithString:jsonUrl]]; JSONDecoder *jsonKitDecoder = [JSONDecoder decoderWithParSEOptions:JKParSEOptionNone]; NSObject *jsonObject = [jsonKitDecoder objectWithData:jsonData error:nil]; int results = [[jsonObject valueForKey:@"resultCount"] intValue]; if(results >0) // has results { NSArray *results = [jsonObject valueForKey:@"results"]; for(NSObject *aResult in results) { NSString *appStoreVersion = [aResult valueForKey:@"version"]; NSString *localVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundLeversion"]; if(![appStoreVersion isEqualToString:localVersion]) { //there is an update available. Go crazy. } } } }
我使用了JSONKit ..您可以使用任何您喜欢的库来解析Apple检索到的JSON.
注意:您可以使用此选项通知用户打开应用程序时有更新.如果您希望在更新生效时立即通知用户,则需要推送通知.
希望这可以帮助.
干杯!
以上是大佬教程为你收集整理的ios – 应用更新通知的文档全部内容,希望文章能够帮你解决ios – 应用更新通知的文档所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。