30

I'm using Xcode 4.5, my iPhone simulator is unable to connect to internet. Internet is working on all my Mac Browsers, but iPhone simulator is unable to connect. I tried opening a web page in Safari in iPhone simulator, but doesn't help.

Afnan
  • 888
  • 1
  • 13
  • 37

8 Answers8

53

1.Turn off lan connection;
2.Turn on wifi;
3.In the iOS Simulator > Settings > Developer > Allow HTTP Services (turn on);
4.Restart Xcode and simulator.

screenshot

beryllium
  • 29,669
  • 15
  • 106
  • 125
Stanislav Ostapenko
  • 1,122
  • 8
  • 14
  • why does this work? and how come internet worked before and now is not working? – Esqarrouth Feb 13 '15 at 14:12
  • 1
    I'm having similar issues in Xcode Version 7.2.1 / Simulator Version 9.2 - I'm getting a Network Error `Network request failed` I've tried the above and it didn't help me. – Agent Zebra Aug 10 '16 at 00:58
  • 1
    Thanks for this, although I'd like to suggest that you make your instructions a bit more detailed - for users who have never touched a Mac or an iPhone until a few weeks ago things are not so obvious. The screen shot is nice, except that I don't recognize the menu bar at the top - is that an older version of OS X or is it a simulated iPad? I assume steps 1 and 2 are for the OS X Preferences. It took me a long time to realize that step 3 involved the Settings app inside the simulated iPhone. Still, thanks again. – RenniePet Mar 05 '17 at 08:10
  • 1
    it took me a while until i figured i need to scroll a bit down to in order to see the the development menu – gor May 10 '20 at 12:00
20

I had the same problem with Xcode 6.2 and iOS 8.2 Simulator. The response field was nil. I tried reseting the simulator, cleaning the product in Xcode, restarting both, restarting the Computer, turning wifi off and on and changing for a different wifi network. Nothing worked. Finally I disabled the Avast Antivirus Shields and it worked.

AlbertoC
  • 431
  • 4
  • 8
9

iOS Simulator (menu, top left) > Reset Content and Settings... fixed it for me. Note this will delete all the apps and associated data you have on the simulator.

shim
  • 9,289
  • 12
  • 69
  • 108
  • This work for me, i also remove DNS at System preference, reboot my router/modem, computer after i done reset content and settings for the ios simulator. – nick Jun 17 '21 at 07:27
5

I'd this problem many times. Turns out I'd added proxy settings added in Network Preferences for my home network but office network didn't use any proxy. That happen to effect only iPhone Simulator but browsers worked fine with it.

Afnan
  • 888
  • 1
  • 13
  • 37
4

I had this problem in xCode8.0. I solved by disabled my proxy go to
System Preference->Network->Advanced(Button)->Select 'Proxies' tab-> Under 'Select the protocol to configure:' disable 'Auto Proxy discovery'

SaRaVaNaN DM
  • 4,390
  • 4
  • 22
  • 30
2

I changed my dns settings and I set it to google dns then it worked. Hopefully it works for you too.

yasin.ce
  • 55
  • 6
1

I've had this issue (also for the App Store), the way I solved it is going to Network Preferences, on the left you delete the current connected connection (-) and add (+) it again.

ggfela
  • 1,162
  • 8
  • 20
0

I was seeing a problem with the same symptoms, running iPhone 6s from the Simulator in OSX Yosemite. Check your version of Xcode. Upgrading from version 6 to 7.0 solved the network issue I was encountering.

Alex Johnson
  • 1,504
  • 13
  • 20