DEV Community

Richard Oakley
Richard Oakley

Posted on

iOS remote debugging - a how-to guide

iOS remote debugging - a how-to guide

When it comes to testing and debugging of iOS applications, the emulator cannot fully replace testing them on actual devices. Well, if you have the possibility to connect iPhone, iPad, etc. directly to your development machine, you don’t have to worry. But what if you needed to inspect an app running on a device which couldn’t be physically connected to your Mac?

Wireless debugging

Apple has added an option for wireless debugging in Xcode 9. But before you start, you should bear in mind several conditions:

  • Mac computer and iOS device should share the same network.

  • You should use Xcode 9.0 or later, macOS 10.12.4 or later, and iOS 11.0 or later.

Okay, now lets proceed to the actual steps that will help you enable a remote debugging:

  1. Open your project on Xcode.
  2. Select Window > Devices and Simulators.
  3. In the window that appears, click “Devices”.
  4. Link your device to your Mac via a USB cable.
  5. In the left column, choose the device, and in the detail area, check the box “Connect via network”.

iOS remote debugging

Now, Xcode will pair with your device. If Xcode can connect with the device over the network, a network icon will appear next to the device in the left column and you can safely disconnect your device.

How to debug iOS apps on remote devices

If the first condition is not met and the device does not share the same network as Mac or even located miles away from the machine, remote debug with the help of Xcode will not be possible.

However, there is a workaround! You will still be able to debug such device with the help of USB over Ethernet redirection software, e.g. FlexiHub. It is designed to virtualize USB devices, (like iPhone, iPad, iPod, etc.) and redirect them over the network. The software works across LAN, Ethernet, and the Internet.

  1. To establish a remote connection to the iOS device, download and install Flexihub on both the local machine running the debugger and a remote computer with the iOS device physically attached.
  2. Launch FlexiHub on the local machine and register an account - click ‘Sign up’ link and follow the instructions. Sign into the account.
  3. Start the software on the remote computer and log into FlexiHub account using the same credentials.
  4. In the software interface on the local Mac, you’ll see iPhone/iPad available for connection. Click “Connect”.

debug iOS app on device

That’s it. Now you can access the remote iOS device from your local computer and start the debugging process as though the device was directly connected to your machine.

Top comments (2)

Collapse
 
oscar37921395 profile image
Oscar

Hi! Tell me, I can do it with USB Network Gate? Or only FlexiHub can do it?

Collapse
 
ayyappa99 profile image
Ayyappa

If the device is at a different place, how can we see what is visible on the device screen to perform testing?