【问题标题】:Wrong App Store app version number from request http://itunes.apple.com/lookup?bundleId=\(identifier)来自请求 http://itunes.apple.com/lookup?bundleId=\(identifier) 的错误 App Store 应用程序版本号
【发布时间】:2019-10-22 21:05:46
【问题描述】:

我通过请求 http://itunes.apple.com/lookup?bundleId=(identifier) 从 appStore 获取我的应用程序的信息字典并收到 1.8.2,但在 appStore 版本是 1.8.3,如果我在 iPhone 上设置应用程序 - 有关应用程序版本的本地信息是正确的1.8.3,为什么appStore请求的版本号错误?

func isUpdateAvailable(completion: @escaping (Bool?, Error?) -> Void) throws ->  URLSessionDataTask {
guard let info = Bundle.main.infoDictionary,
    let currentVersion = info["CFBundleShortVersionString"] as? String,
    let identifier = info["CFBundleIdentifier"] as? String,
    let url = URL(string: "http://itunes.apple.com/lookup?bundleId=\(identifier)") else {
        throw VersionError.invalidBundleInfo
}
print("currentVersion: \(currentVersion)")
let task = URLSession.shared.dataTask(with: url) { (data, response, error) in
    do {
        if let error = error { throw error }
        guard let data = data else { throw VersionError.invalidResponse }
        let json = try JSONSerialization.jsonObject(with: data, options: [.allowFragments]) as? [String: Any]
        guard let result = (json?["results"] as? [Any])?.first as? [String: Any], let version = result["version"] as? String else {
            throw VersionError.invalidResponse
        }
        print("AppStore version: \(version)")
        completion(version != currentVersion, nil)
    } catch {
        completion(nil, error)
    }
}
task.resume()
return task

}

// 使用它我叫:

_ = try? isUpdateAvailable { (update, error) in
    if let error = error {
        print(error)
    } else if let update = update {
        print(update)
    }
}

【问题讨论】:

  • 自发布之日起24小时内继续返回当前版本应用程序版本号不正确,但是是什么原因以及如何获取正确的版本号呢?

标签: ios swift


【解决方案1】:

使用 https: 而不是 http: 作为捆绑 ID。即使在 App Store 显示正确的版本后,我也注意到了同样的事情。过去几个月苹果版本服务器发生了一些变化。

【讨论】:

    猜你喜欢
    • 2015-04-29
    • 2021-11-15
    • 1970-01-01
    • 2013-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-18
    • 1970-01-01
    相关资源
    最近更新 更多