Appstore 版本 API 给出了不同的版本
Appstore version API is giving different version
我正在使用此版本查找 API 来检查更新版本:
https://itunes.apple.com/lookup?bundleId=xxx.yyyyy.zzz
当我从移动应用、Postman 和 AppStore 调用 API 时结果不同
从代码来看,它在 xcode 调试 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)
}
看起来像是缓存问题。尝试忽略缓存数据执行请求
更新:2020 年 10 月 14 日
let url = "itunes.apple.com/lookup?bundleId=(bundleId)"
var urlRequest = URLRequest(url: URL(string: url)!)
urlRequest.cachePolicy = .reloadIgnoringLocalAndRemoteCacheData
我遇到了同样的问题,我尝试了 urlRequest.cachePolicy
但对我不起作用。
以下内容适合我,请仔细检查URL-
这是我的 URL-
"http://itunes.apple.com/lookup?bundleId=(bundleId)"
我改变了这个-
"https://itunes.apple.com/lookup?bundleId=(bundleId)"
如果您可以看到在第一个 URL 中我使用了 http
,在第二个 URL 中我使用了 https
。
请添加 HTTPS,然后检查它是否有效。
干杯!
我正在使用此版本查找 API 来检查更新版本:
https://itunes.apple.com/lookup?bundleId=xxx.yyyyy.zzz
当我从移动应用、Postman 和 AppStore 调用 API 时结果不同
从代码来看,它在 xcode 调试 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)
}
看起来像是缓存问题。尝试忽略缓存数据执行请求
更新:2020 年 10 月 14 日
let url = "itunes.apple.com/lookup?bundleId=(bundleId)"
var urlRequest = URLRequest(url: URL(string: url)!)
urlRequest.cachePolicy = .reloadIgnoringLocalAndRemoteCacheData
我遇到了同样的问题,我尝试了 urlRequest.cachePolicy
但对我不起作用。
以下内容适合我,请仔细检查URL-
这是我的 URL-
"http://itunes.apple.com/lookup?bundleId=(bundleId)"
我改变了这个-
"https://itunes.apple.com/lookup?bundleId=(bundleId)"
如果您可以看到在第一个 URL 中我使用了 http
,在第二个 URL 中我使用了 https
。
请添加 HTTPS,然后检查它是否有效。
干杯!