Not able to "connect via network" for debugging

I am trying to establish a remote connection to an iOS 11 device for debugging. Both devices are on the same Wi-Fi network, I'm using Xcode 9 and in Window->Devices and Simulators have checked the "Connect via network" box. I do not get a network icon next to my device, nor do I get any prompt on the device itself.


The application if for point of sale and the Wi-Fi firewall has most ports blocked. For example, I know port 22 (ssh) is blocked - the only open port I'm certain of is 8080. I suspect the port used for debugging is blocked. What port(s) are used for debugging? I can request the network guys open a few ports if needed.

Post not yet marked as solved Up vote post of kgomara Down vote post of kgomara
37k views

Replies

Have you figured out what port is being used? I am also experiecing the same issue and would love to use the Wireless Debugging functionality.

No answer yet - hopefully someone from Apple will be able to answer. The question isn't difficult, but finding the person who knows the answer may be.

Most problems like this boil down to one of two things:

  • The AP isn’t forwarding multicasts, so you can’t browse for services

  • The AP isn’t forwarding STA-to-STA traffic, so you can’t do any peer-to-peer networking

Note If you’re unfamiliar with my terminology, read Wi-Fi Fundamentals.

You can work around the first problem by the Connect via IP Address command, as discussed in WWDC 2017 Session 404 Debugging with Xcode 9.

There’s no way to work around the second problem other than to reconfigure the AP.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
  • Thanks. Enabling multicasts works.

Add a Comment

Thanks - very well written article about Wi-Fi.


The IT group that manages the Wi-Fi is extremely conservative, I wouldn't be surprised if the AP doesn't forward multicasts OR STA-to_STA traffic. Wish me luck.

Had time to review the Debugging with Xcode 9 session video. Unfortunately I do not see a "Connect via IP Address" option when I control-click on the device. Does that mean the AP is not forwarding multi-casts, or STA-to-STA traffic?


The video also mentioned a document "please check outthe wireless developmentdocumentation." containing more detailed information about ports and so on - I haven't had been able to locate these documents yet. The only mention I see in the "What's new in Xcode 9" article is a reference to Help - which doesn't help much. Can you point me in the right direction?

Unfortunately I do not see a "Connect via IP Address" option when I control-click on the device.

Yeah, that can be a bit persnickety. Here’s what I did to get it to show up:

  1. I turned off Wi-Fi on my device, just to be sure it wasn’t being seen on the network.

  2. I connected it via USB.

  3. In Xcode’s Devices window, I selected the device on the left.

  4. I enabled Connect via Network on the right.

  5. I disconnected the USB; the device moved to the Disconnected section.

  6. I control clicked on the device and Connect via IP Address shows up in the menu.

I didn’t actually choose the menu item because it wasn’t going to work because, hey, the Wi-Fi was off. But that should at least get it to show up.

Does that mean the AP is not forwarding multi-casts, or STA-to-STA traffic?

You can test this as follows:

  1. Run through the process above.

  2. In your Mac, start a Bonjour discovery from Terminal:

    $ dns-sd -B _apple-mobdev2._tcp. local.

    -

  3. Turn on Wi-Fi on the device. You should see

    dns-sd
    log a line like this:
    10:20:24.099  Add        2   5 local.               _apple-mobdev2._tcp. 40:33:1a:d7:f4:9b@fe80::4233:1aff:fed7:f49b

    where

    40:33:1a:d7:f4:9b@fe80::4233:1aff:fed7:f49b
    is the Bonjour service name (it seems that Xcode uses the MAC address and the link-local IPv6 for the service name, which is wacky but there you go).

If the service doesn’t show up, Wi-Fi multicast is disabled. In that case you can try the Connect via IP Address process described above. If that doesn’t work, it’s likely that all STA-to-STA networking is disabled.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
  • Thank you! Solved! Had same issues here. I went back through first tests and tried a variation. With device wifi on but not visible to xcode I control + clicked the device to see the Connect via IP Address option then enter device IP Address. Then with the IP window remaining open I connected device via USB then once device detected by Xcode I went back to Devices and Simulators then selected to connect via IP. Not sure why but that worked for me! Needed USB connect to execute wifi connect?

Add a Comment

I'm not sure if this will help you at all, but I came upon your post trying to fix the same issue with my app and Xcode.


I had it working previously no problem by just checking "Connect via Network" in the Devices/Simulators window but somehow it stopped working.


To fix it, I had to make sure that my app installed on my device via Xcode was removed (only had the 1). As soon as I uninstalled that, the Network icon appeared right by my device and it started working again. This was also done by unpairing the device and re-pairing it to Xcode, but that by itself didn't fix it. Maybe this will help someone else!

This helped me.. I uninstalled the previous app, unpaired the device and then it appeared in the network rightaway .. then paired again.. now my apple tv is showing!! Thanks a bunch!!!

For me connect via network worked flawlessly on my home Wi-Fi, but I always wanted to go in the park and have the freedom of developing applications without the cable, where my iPhone provides Internet via its hotspot. Thanks to eskimo's advice, under devices, I selected connect via IP: 172.20.10.1 and now it just works.

It would be nice if Apple reconsiders the hotspot and allows wireless debugging and all the other useful features to work without the need of entering IP manually or looking for workarounds.
GameDevBryant had the answer for me. I just had to delete the app from my iPhone that had been installed via Xcode. The Network Symbol appeared immediately in Devices and Simulators. Thanks.
Hello everyone,

We are facing a ver similar issue to the one explained above, but with the "small" difference that none of what has been suggested worked for us...

Let me share some background info: network connection has been working flawlessly between the mac Pro and the iPhone for months, until we moved to a new office. From that day onwards, it stopped working.

The problem is the one explained above: when we click on "connect via network", nothing happens (connection is not established). We can work around that by using the "Connect via IP" option, which works well until we reboot the mac or the iPhone's IP changes. Then we need to open Xcode again and perform the "Connect via IP" again - which is in fact a no-go for us since we use this set up for test automation.

We've tried everything:
  • We did our first attempt on the network level: we can see that there are multicast message exchanged (and replied to) between the two devices. The thing is, after the initial query by the mac, and the response from the iPhone, nothing else happens. But, anyway, it seems like it's not a multicast problem...

  • Regarding STA-to-STA communication, from the configuration perspective there doesn't seem to be any problem either. And the fact that the initial multicast messages are actually sent seems to support that theory as well.

  • In terms of configuration, we've tried everything:

    • Unpair and re-pair mac and iPhone

    • Uninstall all "development" apps on the iPhone

    • Reset the iPhone to factory settings

Unfortunately, none of these worked...

So: does anyone have a hint that could help us?

Thanks in advance,
Marc
  • I got a different variation of the problem. The wifi has no STA-STA limits, pinging the IP of the TV works without a problem. But the "connect via network" button is disabled and as soon as I unplug the TV, it's gone and I cannot access it in Xcode. (ping/ airplay etc still continues to work) ( log-out /in Apple ID also not helping )

    Any further suggestions?

Add a Comment

I discovered that my iMac and iPad are on different networks. My home WiFi router has the usual main network/guest network separation, where the guest network can only to to the Internet. When I moved my iPad to my main network the "Connect via network" workflow worked--I now see the icon next to my iPad name. And, of course, I was able to launch my app wirelessly.

Something minor to check.

I found that you have to be patient. After checking "Connect via network" and disconnecting the cable, it will say "Disconnected" above the device in the left panel of the Devices and Simulators window. You need to wait until it says "Connected" again (without plugging in the cable). This can take 30-60 seconds. After that, it should work.