美文网首页
swift开发获取APPStore中的版本信息

swift开发获取APPStore中的版本信息

作者: 蛋哥是只猫 | 来源:发表于2018-09-01 15:56 被阅读0次

    现在发现我们的版本发布后没有更新提示,使用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  
                        }
                    }
                }
            }
    

    相关文章

      网友评论

          本文标题:swift开发获取APPStore中的版本信息

          本文链接:https://www.haomeiwen.com/subject/hzruwftx.html