Appstore版本API提供了不同的版本

时间:2020-11-12 13:01:45

标签: ios swift xcode app-store version

我正在使用此版本查询API来检查更新的版本:

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

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

从代码开始,它在xcode调试3.0.0中显示旧版本:Xcode debug

在Postman中显示的是正确的版本4.0.0:enter image description here

在AppStore中,它还会显示正确的版本4.0.0:enter image description here

当我从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)
}

2 个答案:

答案 0 :(得分:1)

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

更新:2020年10月14日

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

答案 1 :(得分:0)

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

以下内容对我有用,请仔细检查 URL-

这是我的网址-

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

我改变了这个-

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

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