0

Users of an app I took over recently are reporting network error alerts like those:

Network error (-1009)

Network error (-1001)

Network error (-1005)

Network error (2)

enter image description here

(Fejl is Danish for Error)

The error are: NSURLErrorTimedOut, NSURLErrorNetworkConnectionLost, NSURLErrorNotConnectedToInternet, so mostly about bad/lost connection to the server.

AFNetworking 3.0 is used.

In the request headers we find Connection: close and the timeout is set to 15 seconds request.timeoutInterval = 30

First, I couldn't find showing an alert anywhere in the source code, so I would like to know if the displayed alerts on network errors are handled by iOS?

Then, I am looking for a way to simulate those errors. I tried with the Network Link Conditioner on a device but didn't get any of those errors.

The errors and their respective error codes are listed here: https://developer.apple.com/reference/foundation/1508628-url_loading_system_error_codes?language=objc

Community
  • 1
  • 1
Blackbeard
  • 652
  • 2
  • 8
  • 22
  • iOS never shows network alerts on its own, until it is defined somewhere. Are you using any third party library? I guess it might be coming from there. By the way you need to add [App Transport Security](http://stackoverflow.com/a/32817873/790842) that might be missing and causing the error. – iphonic Mar 07 '17 at 09:36
  • Yes, AFNetworking 3.0 is used in the project. – Blackbeard Mar 07 '17 at 09:39
  • But one comment says that the [NSAppTransportSecurity key is no longer accepted](http://stackoverflow.com/questions/30731785/how-do-i-load-an-http-url-with-app-transport-security-enabled-in-ios-9/32817873#comment64811499_32817873) – Blackbeard Mar 07 '17 at 09:44
  • You still need to add it the only thing changed is the url must be `https` – iphonic Mar 07 '17 at 09:46
  • But if I enable NSAllowsArbitraryLoads wouldn't that allow unsecured connections? I am using HTTPS connections to dev, staging and production servers, so maybe the issue is not there? – Blackbeard Mar 07 '17 at 09:50

0 Answers0