iOS Can't perform HTTP GET request -Error Domain=NSURLErrorDomain Code=-1012

一个人想着一个人 提交于 2019-11-29 03:26:10

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)

manroe

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!