自最新更新以来获得错误。 无法从https网站返回数据。
请帮忙
代码:
func GetValueFromWebsite(_ Url: String, ShowError: Bool) -> String {
var xml:String = ""
let url = URL(string: Url)
let request = NSMutableURLRequest(url: url!)
let session = URLSession.shared
session.sendSynchronousRequest(request: request) { data, response, error in
xml = String(data: data! as Data, encoding: String.Encoding.utf8)!
xml = xml.replacingOccurrences(of: "\"", with: "")
xml = xml.replacingOccurrences(of: "\r\n", with: "")
}
return xml
}