I am trying to perform a HTTP Get request, but I keep on getting Error Domain=NSURLErrorDomain Code=-1012 error. MY code is :
@try {
NSString *url = [[N
This error is NSURLErrorUserCancelledAuthentication
Returned when an asynchronous request for authentication is cancelled by the user. This is typically incurred by clicking a “Cancel” button in a username/password dialog, rather than the user making an attempt to authenticate.
It means you need authentication to access the resource which you are trying to access w/o signing your request properly (wrong agentSecret or API_ID or API_SECRET)
You may get this error while hitting a HTTPS (not HTTP) URL with a bad/expired certificate with AFNetworking. (Chrome shows the "Your connection is not private" message when hitting the URL).
For my case i just set Yes for following flag of afnetworking http client. allowsInvalidSSLCertificate = YES, it starts working for https get request.
If it helps anyone, you will get this error whenever a server sends back a 401
(unauthorized) status code.