【问题标题】:Appstore version API is giving different versionAppstore 版本 API 给出不同的版本
【发布时间】:2021-02-24 11:43:21
【问题描述】:

我正在使用这个版本查找 API 来检查更新的版本:

https://itunes.apple.com/lookup?bundleId=xxx.yyyyy.zzz

当我从移动应用、Postman 和 AppStore 调用 API 时结果不同

从代码来看,它在 xcode debug 3.0.0 中显示旧版本:

在 Postman 中显示正确的 4.0.0 版本:

在 AppStore 中,它也显示正确的 4.0.0 版本:

当我从 xcode 和移动应用程序调用 API 时,为什么它没有显示正确的版本? 我正在使用 alamofire:

let bundleId = Bundle.main.infoDictionary!["CFBundleIdentifier"] as! String
AF.request("https://itunes.apple.com/lookup?bundleId=\(bundleId)").responseJSON { [weak self] response in
    print(response.result)
}

【问题讨论】:

    标签: ios swift xcode app-store version


    【解决方案1】:

    看起来像一个缓存问题。尝试执行忽略缓存数据的请求

    更新:14.10.2020

    let url = "itunes.apple.com/lookup?bundleId=(bundleId)" 
    var urlRequest = URLRequest(url: URL(string: url)!) 
    urlRequest.cachePolicy = .reloadIgnoringLocalAndRemoteCacheData
    

    【讨论】:

    • 谢谢,成功了:let url = "itunes.apple.com/lookup?bundleId=(bundleId)" var urlRequest = URLRequest(url: URL(string: url)!) urlRequest.cachePolicy = .reloadIgnoringLocalAndRemoteCacheData
    • 酷,欢迎。我还更新了我的评论,让未来的访问者更清楚。
    【解决方案2】:

    我面临同样的问题,我尝试了urlRequest.cachePolicy,但对我不起作用。

    下面的东西对我有用,请仔细检查网址-

    这是我的网址-

    "http://itunes.apple.com/lookup?bundleId=(bundleId)"
    

    我改变了这个-

    "https://itunes.apple.com/lookup?bundleId=(bundleId)"
    

    如果您可以在第一个 URL 中看到我使用 http,在第二个 URL 中看到我使用 https。 请添加 HTTPS,然后检查它是否有效。 干杯!

    【讨论】:

    • 谢谢伙计。更改为 Https 确实对我有用。
    猜你喜欢
    • 2012-07-02
    • 2019-09-24
    • 2021-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-27
    相关资源
    最近更新 更多