Skip to content

On-Device iOS Debugging in Xojo

You may or may not be aware that running iOS projects in the Simulator does not allow you to check all of your app’s features. There are a few features which rely on hardware capabilities which the Simulator cannot emulate. This can make it hard to track down bugs, and the only recourse is console logging. Starting in Xojo 2022r1 it’s possible to run your apps right on a physical device connected by USB. Learn how in this post.

Setup

Debugging on device requires your device be connected to your computer using a lightning cable.

Computer
You’ll need to launch Xcode, plug your phone in using USB and open Xcode’s Devices and Simulators window. In the navigation pane on the left, select the device and check the Show as run destination checkbox.

Device
If you’ll be debugging over USB, go to the Settings app on your device, select Personal Hotspot and turn that on.

Apple Developer Portal

For on-device debugging, your app profiles must be set up properly. For help on this, read The Crazy Exercise That Is The Apple Signing Process.

  1. Certificates: You will need a Development certificate for yourself. Download it and double-click the file to install it.
  2. Identifiers: You will need an Application Identifier that matches the Bundle Identifier in your app.
  3. Devices: You must register all of the devices that you intend to debug on.
  4. Profiles: You will need to create a Development profile for the app and make sure it contains your Development certificate (from step 1) as well as each of the devices that you want to debug on (step 3). Download the profile and double-click the file to install it.

Xojo

Debugging on-device requires that you set the Team from your account as well as setting the Build For property to App Store.

When you’re ready to run on a device, from the menu select Project > Run On and select your device from the list. If everything is configured properly, your app should be transferred to the device and automatically run for you.

Notes

The first time you debug an app, you will get a dialog on the device asking if your app can connect to the local network. You will need to allow that and then run your app from Xojo again.

Don’t allow your device to go to sleep while waiting for the app to build and transfer or the app won’t be able to launch. You can increase the amount of time on the device by going to Settings > Display & Brightness and selecting a new Auto-Lock timeout. The options are 2, 5, 10 or 15 Minutes or Never.