我正在使用此版本查询API来检查更新的版本:
https://itunes.apple.com/lookup?bundleId=xxx.yyyyy.zzz
当我从移动应用,Postman和AppStore调用API时,结果是不同的
当我从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)
}
答案 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,然后检查它是否有效。
干杯!