ios – iTunes查找API在我的APP中返回旧数据

我的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 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];
        }
    }
    });
}

解决方法

我也面临同样的问题,但在我的情况下,我使用http(例如 http://itunes.apple.com/lookup?bundleId=com.xxx.xxxx),所以没有获得最新的应用程序版本.然后我将http替换为https( https://itunes.apple.com/lookup?bundleId=com.xxx.xxxx),之后它为我工作.

更新 – 我们的团队向苹果开发人员发送了邮件,并询问为什么https正在运行且http无效,并得到苹果团队的回复.他告诉“一般情况下,更新的应用信息会延迟24小时从App Store Connect发送给公众.”

有关更多信息,请参阅他们的电子邮件回复-

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...