现在发现我们的版本发布后没有更新提示,使用https://itunes.apple.com/lookup?id=测试发现没有获取到版本信息,更改为https://itunes.apple.com/cn/lookup?id=后成功获取到。查资料发现是使用var path = "https://itunes.apple.com/lookup?id="能够获取到,但是对于版本更新是有延迟的
// var path = "https://itunes.apple.com/lookup?id="
var path = "https://itunes.apple.com/cn/lookup?id="
path = path + "APP在App Store Connect中的APP ID"
var releaseNotes:String = ""
var trackViewUrl:String = ""
var version:String = ""
Alamofire.request(path, method: .post).response { (responseObj) in
if responseObj.error == nil {
let dic:Dictionary = try! JSONSerialization.jsonObject(with: responseObj.data!, options: JSONSerialization.ReadingOptions.mutableContainers) as! Dictionary<String,Any>
if dic["resultCount"] as! Int > 0{
let results:Array = dic["results"] as! Array<Any>
if results.count > 0 {
let resultsDic:Dictionary = results.first as! Dictionary<String,Any>
version = resultsDic["version"] as! String
if loactionStoreVersion == version {
return
}
// 本次版本更新的内容
releaseNotes = resultsDic["releaseNotes"] as! String
// 在APP Store中的链接
trackViewUrl = resultsDic["trackViewUrl"] as! String
}
}
}
}
网友评论