How do you perform wireless debugging in Xcode 9 with iOS 11, Apple TV 4K, etc?

Wireless debugging was recently added as a feature in Xcode 9, iOS 11, and tvOS 11. Apple TV 4K doesn't have a USB port, so it requires wireless debugging. How do you perform this wireless debugging in Xcode?


Solution 1:

Set up a device for network debugging

from help.apple.com

Debug your app running on an iOS or tvOS device over a Wi-Fi or other network connection.

Steps to set up iPhone, iPad, or iPod touch

  1. Check that your device has a passcode and add one if it doesn't. Your device must have a passcode to enable remote debugging

  2. The Mac and the iPhone/iPad need to be on the same network to use wireless debugging.

Next, in Xcode

  1. Choose Window > Devices and Simulators, then in the window that appears, click Devices.
  2. Connect your device to your Mac with a Lightning cable.
  3. In the left column, select the device, and in the detail area, select Connect via network.

enter image description here

Xcode pairs with your device. If Xcode can connect with the device using a network, a network icon appears next to the device in the left column.

enter image description here

  1. Disconnect your device.

Now you are ready for debugging over the network.

Sometimes it doesn't work. You might need to restart the device or network connection.

Note: Network debugging requires Xcode 9.0 or later running on macOS 10.12.4 or later, and on the device, requires iOS 11.0 or later, or tvOS 11.0 or later.


Steps to set up Apple TV:

  1. Make sure your Mac and your Apple TV are on the same network.

  2. Choose Window > Devices and Simulators, then in the window that appears, click Devices.

  3. On your Apple TV, open the Settings app and choose Remotes and Devices > Remote App and Devices.

  4. The Apple TV searches for possible devices including the Mac. (If you have any firewall or Internet security, disable/turn it off to allow searching.)

  5. On your Mac, select the Apple TV in the Devices pane. The pane for the Apple TV is displayed and shows the current status of the connection request.

  6. Enter the verification code displayed on your AppleTV into the Device window pane for the device and click Connect.

Xcode sets up the Apple TV for wireless debugging and pairs with the device.

enter image description here

enter image description here

Solution 2:

I have tried using Xcode Devices window's Connect via network options. but I am unable to see the "Connected over the network" icon next to the device name. also as soon as remove the USB the "Connect via network" option disappeared. also, the device name appears under the disconnected device list.

But using the "Connect via IP Address..." option, I am able to connect.

  1. Right-click on the device name(Under Disconnected list) and choose "Connect via IP Address...." option.

enter image description here

  1. Type the IP address of the device and chose Connect. (you can find through mobile device Settings > Wi-Fi > Choose the wifi name) enter image description here

Solution 3:

If you have completed all steps given by Surjeet and still not getting network connection icon then follow below steps:

  1. Unpair Device using right click on the device from the Connected section.

    enter image description here

  2. Reconnect the device.

  3. Click on "+" button from the end of the lefthand side of the popup.

enter image description here

  1. Select the device and click on next button

enter image description here

  1. Click on Trust and passcode(if available) from the device.

enter image description here

  1. Click on Done button.

enter image description here

  1. Now, click on connect via network.

enter image description here

Now you can see the network connection icon after the device name. Enjoy!

enter image description here

Solution 4:

Prerequisite

  • Your Mac Machine should have at least Mac OSX 10.12.4 or later
  • Your iOS device should have at least iOS 11.0 or later
  • Both devices should be on same network.

Steps to Activate

  • Plug your iOS device with Mac machine from cable.

  • Open Xcode then from top menu Window -> Devices and Simulators

  • Chose Devices segment and chose your desired Device from left device list.

  • On right side you can see open Connect via network, enable this option as shown in attached image. Connect via network

  • After few seconds you can see network sign in front of you device. enter image description here

  • Unplug your device and use debugging as you're using normally.

Thanks