我的APP通过比较iTunes查找API返回的本地版本和远程版本来检查更新.但新版本发布后,API仍会返回旧版本.
https://itunes.apple.com/us/lookup?bundleId=com.xxx.xxxx
如果我通过浏览器请求,此API返回新版本(4.9),但在APP中返回旧版本(4.8.1).
有人帮忙吗?谢谢.
- (void)updateAppInfo
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//first check iTunes
NSString *iTunesServiceURL = [NSString stringWithFormat:@"https://itunes.apple.com/us/lookup"];
iTunesServiceURL = [iTunesServiceURL stringByAppendingFormat:@"?bundleId=%@", [[NSBundle mainBundle] bundleIdentifier]];
NSLog(@"iRate is checking %@ to retrieve the App Store details...", iTunesServiceURL);
NSError *error = nil;
NSURLResponse *response = nil;
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:iTunesServiceURL] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSInteger statusCode = ((NSHTTPURLResponse *)response).statusCode;
if (data && statusCode == 200)
{
//in case error is garbage...
error = nil;
id …
Run Code Online (Sandbox Code Playgroud)