Xcode 9.0 Beta (Wireless debugging on iOS 11)

I hope you enjoyed the WWDC keynote with awesome hardware and software upgrades. And for developers there is new Xcode 9.0.

Xcode 9.0 is full of new features

  • All new editor. Fast, structure-based editor that lets you intelligently highlight and navigate your code. Includes great Markdown support.
  • Refactoring. Refactoring built right into the editing experience and works across Swift, Objective-C, Interface Builder, and many other file types. Select variable by holding cmd ⌘ on popup menu you will see rename option.
  • Debugging. Wirelessly debug iOS and tvOS devices over the network, new debuggers for Metal, and more features throughout Xcode.
  • Source Control. All new source control navigator and integrated support for GitHub accounts for quickly browsing repositories and pushing your repositories to the cloud.
  • Xcode Server built-in. Continuous integration bots can be run on any Mac with Xcode 9, no need to install macOS Server.
  • New Playground templates. Includes iOS templates designed to run well in both Xcode and Swift Playgrounds in iPad.
  • New Build System. An opt-in preview of Xcode’s new build system provides improved reliability and performance.

Wireless Debugging

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.

Set up an iPhone, iPad, or iPod touch

  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.
  4. 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.

5. Disconnect your device.

6. It is now ready for debugging over the network.

Launch your app on a networked device

Most of the time the Mac and device will be on the same WiFi network and Xcode will connect using Bonjour. Sometimes you need to connect to a remote device or can not use Bonjour. When that happens, you can connect using the IP address of the device.

Connect using bonjour

  1. Connect your Mac and the device to the same network.
  2. In the toolbar, choose the device from the scheme menu.
  3. In the toolbar, click the Run button.

Connect using an IP address

  1. Make sure your Mac and device are connected to a network.
  2. Choose Window > Devices and Simulators, then in the window that appears, click Devices.
  3. Control-click on the desired device in the list of devices.
  4. In the pop-up menu that appears, choose Connect via IP Address.
  5. Enter the the IP address of the device in the dialog that appears and click Connect.

iOS: Open Settings and choose Wi-Fi. Click the Info button next the active network to see the IP address

  1. Once the device is connected, run your app.

Unpair a network debugging device

  1. Choose Window > Devices and Simulators, then in the window that appears, click Devices.
  2. In the list of devices on the left, Control-click the desired device.
  3. In the pop-up menu that appears, choose Unpair Device.

Troubleshoot network debugging

Before you begin, ensure that:

  • The Mac and the device are on the same network.

Verify that Xcode can see the device

  • Choose Window > Devices and Simulators, then in the window that appears, click Devices.
  • The device should appear under Connected in the left column.

Ping the device

  1. Find the IP address of a device of the device.
  2. On your Mac, open Terminal.
  3. Type ping followed by a space and the IP number you found above.
  4. If the Mac can see the device, the output should look like:
  5. > ping 10.0.1.2PING 10.0.1.2 (10.0.1.2): 56 data bytes64 bytes from 10.0.1.2: icmp_seq=0 ttl=64 time=97.413 ms64 bytes from 10.0.1.2: icmp_seq=1 ttl=64 time=141.892 ms
  6. If there is an error, you will see lines that look like:
  7. Request timeout for icmp_seq 0

If you can ping your device that means it is visible on the network. If you have not already done so, check that port 62078 is open.

If you can not ping your device it can mean that ICMP is blocked or that there is some other connectivity issue. Use an Ethernet cable to connect the device.

Check that port 62078 is open

  • Network debugging uses port 62078 for communication. Some networks block certain ports. Depending on your situation, you will need to check your own network settings, or check with your network administrators.

Use an Ethernet cable to connect the device

  • Connect the device to the same network using an Ethernet cable.
  • For an Apple TV, connect using the Ethernet port in the back of the device.
  • For an iPhone, iPad or iPod Touch, use the Lightning to USB Camera adapter and a USB to Ethernet adapter.

Re-set up the network device

  • Unpair the device and go through the set up process again.

Overall wireless debugging is not robust yet & has it’s loose connection but give it a try.

iPhone Developer