Hallo,
I am trying to send a Http-Request to an ESP8266. The connection isn't secure (Cleartext/Http), but that isn't a problem for my Application.
let urlComp = NSURLComponents(string: urlString)!
var urlRequest = URLRequest(url: urlComp.url!)
urlRequest.httpMethod = "GET"
let config = URLSessionConfiguration.default
let session = URLSession(configuration: config)
let task = session.dataTask(with: urlRequest, completionHandler: { (data, response, error) in
})
task.resume()This is my code for doing this. But I get an error. I found out that I have to allow non-https connections, so I addet following lines to myInfo.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>Please tell me how I can solve this "ERROR 1002" or if ther is a other way for this http-request and what the code for it is.
Greetings from Germany
Steffen Rohwer (absolutely Noob)