首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >iTunes查找API返回我的应用程序中的旧数据

iTunes查找API返回我的应用程序中的旧数据
EN

Stack Overflow用户
提问于 2017-04-05 09:11:32
回答 4查看 4.2K关注 0票数 15

我的应用程序通过比较本地版本和iTunes查找API返回的远程版本来检查更新。但是API在新版本发布后仍然返回旧版本。

https://itunes.apple.com/us/lookup?bundleId=com.xxx.xxxx

如果我通过浏览器请求,这个API返回新版本(4.9),但在APP中返回旧版本(4.8.1)。

有人帮忙吗?谢谢。

代码语言:javascript
运行
复制
- (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];
        }
    }
    });
}
EN

Stack Overflow用户

发布于 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小时,然后它开始给我正确的版本,然后我能够强制更新我的应用程序的版本检查。

票数 1
EN
查看全部 4 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43226752

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档