INNER CODE UNIT · Swift
appUrl
rhymelph/r_upgrade · ios/Classes/SwiftRUpgradePlugin.swift:85
let appUrl = checkLink + appId
let url = NSURL(string: appUrl)! as URL
let request = NSMutableURLRequest(url: url, cachePolicy: NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData, timeoutInterval: 30)
request.httpMethod = "GET"
let session = URLSession.shared
let task = session.dataTask(with: request as URLRequest){(data,response,err) in
if err == nil{
if data == nil{
NSLog("获取appId:%@ 对应的appStore信息失败",appId)
complete(nil)
}
let httpRequest = response as! HTTPURLResponse
if httpRequest.statusCode == 200 {
let json = try! JSONSerialization.jsonObject(with: data! as Data, options: JSONSerialization.ReadingOptions.mutableLeaves) as! NSDictionary
if json["resultCount"] as! Int > 0{
complete(json)