我的应用程序通过比较本地版本和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 json = nil;
if ([NSJSONSerialization class])
{
json = [[NSJSONSerialization JSONObjectWithData:data options:(NSJSONReadingOptions)0 error:&error][@"results"] lastObject];
}
else
{
//convert to string
json = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
}
if (!error)
{
self.appStoreId = [self valueForKey:@"trackId" inJSON:json];
self.latestVersion = [self valueForKey:@"version" inJSON:json];
self.releaseNote = [self valueForKey:@"releaseNotes" inJSON:json];
}
}
});
}
发布于 2020-01-03 06:29:08
我也面临着同样的问题。它有两个步骤来解决这个问题。
我使用的是http://itunes.apple.com/lookup?bundleId="YOUR包ID“而不是https。
步骤1:请确保您使用的是https,而不是http,因为它不会提供更新的版本号。首先,我用1.8.0版本上传了我的应用程序,然后用1.9.0版本,然后用1.9.1版本上传了应用程序。当我使用http时,它总是向我展示1.8.0,即使是应用程序商店的应用程序也有1.9.1的版本。因此,以后只需使用https即可。
步骤2:上传最新版本后,请等待24小时,以便在https://itunes.apple.com/lookup?bundleId=上获得最新版本“您的包ID"。我得到了版本1.9.0,尽管该应用程序在24小时内与版本1.9.1一起运行。我等了24小时,然后它开始给我正确的版本,然后我能够强制更新我的应用程序的版本检查。
https://stackoverflow.com/questions/43226752
复制相似问题