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

现在发现我们的版本发布后没有更新提示,使用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  
                    }
                }
            }
        }
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容