30

For some reason the wireless debugging does not work here. Here is what I've done:

  • Using newest Xcode 9
  • Using newest iOS 11 on my iPhone 7+
  • Both devices are in the same network
  • Connected the iPhone via Lightning, selected "Connect via Network" in the Devices & Simulator menu
  • Run an app on the iPhone while still connected via Lightning - everything works

But as soon as I unplug the phone, Xcode is no longer able to connect with the phone. I can ping the phone with the Mac, but even the "connect via ip" option in Xcode does not work.

Anybody got tips on how to get this working?

user2529173
  • 1,884
  • 6
  • 30
  • 43

6 Answers6

70

I had the same issue, but it was intermittent - i.e. sometimes the globe would not appear next to the phone name in Xcode Devices and Simulators window and when the phone was disconnected from the lighting cable, I could not debug to it from Xcode. My fix was much simpler, though - I just turned WiFi on and off both on the Mac and on the phone. After the devices reconnected to the network wireless debugging was available again. This seems to be an issue with the network communication (regardless whether the device can be pinged or not).

Fuad Kamal
  • 1,162
  • 10
  • 14
  • 1
    I've used the other solutions before, but today the phones decided to work differently... (thanks, Apple.... :( - this was the only thing that worked - even turning the phone off and resetting didn't do it. Thanks for the SIMPLE answer that I needed today! – Apps-n-Add-Ons Dec 01 '17 at 11:52
  • 4
    Fast forward to 2019 - this issue is still not fixed ... :( – Bogdan Razvan Feb 12 '19 at 06:56
  • 1
    Actually, seems like turning your Mac's WiFi off and back on is sufficient (no need to do the same for your iOS device). Still an occasional issue as of Xcode 10.2.1, however seems to have gotten better. – bcause Jun 28 '19 at 16:48
  • 1
    @BogdanRazvan Fast forward to 2020 - this issue is still not fixed :( – h.and.h Aug 05 '20 at 20:12
  • 4/11/2020 still not fixed, we have to turn of wifi of Mac and iphone :( – Coder ACJHP Nov 04 '20 at 14:46
15

Make sure System Preferences->Internet Sharing is enabled using USB ports:

Sharing is caring

Matthew Korporaal
  • 2,369
  • 1
  • 20
  • 25
  • 1
    This was the problem for me. Connecting remotely wouldn't work until I enable this in settings. When I want to disable it once again I can't connect remotely. – asanli Feb 12 '19 at 12:59
  • 1
    This solution worked for me. Internet sharing was set to off. – dot3 Sep 04 '19 at 12:05
4

I was able to find a solution to this on another stack overflow question: How do you perform wireless debugging in Xcode 9 with iOS 11, Apple TV 4K, etc?.

You can also check this answer: "Connect via network" wireless debugging not working Xcode 9

Near the bottom, from "IOS DEV". Briefly, the solution ended up to be to unpair my phone, disconnect and re-pair. After that Xcode automatically added it with the globe. As an FYI, I was able to ping my iPhone using the network utility prior to the un-paring but was still unable to get the phone to connect. good luck.

Shital Sharma
  • 17
  • 1
  • 5
3

Restarting xcode is the only thing that fixed this intermittent connectivity problem for me.

RawMean
  • 8,374
  • 6
  • 55
  • 82
1

I realized this can also happen if my Mac is connected to a VPN. I had to:

  1. Kill the VPN connection
  2. Turn the computer's wifi off and back on
  3. Open Devices and Simulators
  4. Plug the device in and the globe icon should appear.
  5. Unplug the device and make sure the globe icon is still there.
  6. Run the app via network!
Swindler
  • 802
  • 10
  • 9
0

Wireless debugging mysteriously stopped working for me until I turned off my VPN client. I now believe that I had the VPN turned off when I was trying it out the first time, but then the VPN auto-connected after my computer restarted sometime later.

bruce1337
  • 330
  • 6
  • 16