xcode - get value from website in mac OS 10.12.1 & iOS 10.1.1 -
getting error since latest update. can't data returned https website.
please help
code:
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! data, encoding: string.encoding.utf8)! xml = xml.replacingoccurrences(of: "\"", with: "") xml = xml.replacingoccurrences(of: "\r\n", with: "") } return xml }
Comments
Post a Comment