On a button press action, I'm trying to invoke a logout request to a server. Here is the action code:
@IBAction func buttonpress(_ sender: UIButton) {
Alamofire.request("https://securelogin.pu.ac.in/cgi-bin/login?cmd=logout").responseString { response in
debugPrint(response)
print(response.request)
print(response.response)
print(response.data)
print(response.result)
if let JSON = response.result.value {
print("JSON \(JSON)")
}
}
}
But the response of this request always fails with the following error:
[Request]: GET httpbin.org/get [Response]: nil [Result]: FAILURE: Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x1742425e0 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=httpbin.org/get, NSErrorFailingURLKey=httpbin.org/get, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.} Optional(0 bytes) FAILURE
Can you please point me out what might cause this failure?