How to set a timeout with AFNetworking

Changing the timeout interval is almost certainly not the best solution to the problem you’re describing. Instead, it seems like what you actually want is for the HTTP client to handle the network becoming unreachable, no? AFHTTPClient already has a built-in mechanism to let you know when internet connection is lost, -setReachabilityStatusChangeBlock:. Requests can take … Read more

NSURLSession/NSURLConnection HTTP load failed on iOS 9

Found solution: In iOS9, ATS enforces best practices during network calls, including the use of HTTPS. From Apple documentation: ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt. You should adopt ATS as soon as possible, regardless of whether you’re creating a new app or updating an existing one. If you’re … Read more

Request failed: unacceptable content-type: text/html using AFNetworking 2.0

This means that your server is sending “text/html” instead of the already supported types. My solution was to add “text/html” to acceptableContentTypes set in AFURLResponseSerialization class. Just search for “acceptableContentTypes” and add @”text/html” to the set manually. Of course, the ideal solution is to change the type sent from the server, but for that you … Read more

tech