0

Can't load map in one of my view controllers. I checked the other stackoverflow post: NSURLConnection GET request returns -1005, "the network connection was lost" but it isnt working for me.

Here is an image of my view controller and error message:

i.imgur.com/cdaUX1z.png

I've tried resetting content settings, relaunching simulator and different wifi connections.

Do you guys have any other suggestions?

Community
  • 1
  • 1
jshah
  • 1,599
  • 2
  • 17
  • 38
  • In xcode 6 its a bug when net connection lost it always shows the error until we restart our simulator. – vishnu Jan 20 '15 at 06:02
  • @vishnu to double check, what is restarting my simulator? Quitting it or resetting content settings? I've tried both. – jshah Jan 20 '15 at 18:48
  • I suffered the same behavior when I went to add a iOS 8.1 simulator in Xcode 8.2.1. – Rob Jan 06 '17 at 22:51

3 Answers3

2

"The network connection was lost" means exactly that. Your device lost its network connection. Can happen with any device, any time. Your app should handle this gracefully.

Looking at your own reply: So if a customer runs into this problem, you are going to visit them and set up a proxy for them?

gnasher729
  • 51,477
  • 5
  • 75
  • 98
  • You're right, I need to be able to handle that. For now, I was just happy that the map was able to load. But thinking about your question, I should be able to save the state of infromation I currently have on my app and let the user know that the app isn't funcitonal without a network connections. What are my options for handling network connection loss techinically? Is there any listener methods for alerting the user when such a loss happens? – jshah Jan 21 '15 at 04:56
  • No, I suspect "network connection was lost" does not mean just that. It's a bug in the simulator that I've encountered, too. – Rob Jan 06 '17 at 22:45
1

Restart your simulator and run it. Then it will works fine.

vishnu
  • 715
  • 9
  • 20
  • I've tried this multiple times and it hasnt worked. Just double checking, by restarting you mean quitting the simulator or resetting content settings? – jshah Jan 20 '15 at 18:09
1

Using Charles or setting up a Secured Web Proxy (HTTPS) solved the problem for me.

jshah
  • 1,599
  • 2
  • 17
  • 38