iOS app on real iPad can't connect to the debugger

Hi,

I know this topic has been discussed over and over, but existing threads don’t seem to be of help for my issue.

In the IDE, I’m trying to debug an iOS app on my iPad. The device is connected straight in my mac mini using USB, and is recognised by Mac OS.

So I choose “Run” (or “Run on”, no difference), the progress, well, progresses, the app appears in the iPad and launches. At this point, the screen stays white on the iPad and the modal dialog in the IDE is replaced by the “Launching Application…” UI (with the indeterminate progress bar).
Around ten seconds later, the screen of the iPad turns black (not the whole screen, only the “window”) and the IDE stops showing the wait UI (the debugger tab stays shown, but empty).
Seconds later, the iPad app says “Cannot connect to the debugger” and the app quits; the IDE keeps the debug tab open. I can also mention that clicking on the “OK” button in the “cannot connect” message takes more than 5 seconds, like the remaining steps, as if there was a general slow down (but that’s perhaps misleading?).

The bundle identifier is set (and the built app works, so the identifier is not related to the issue), “team” and “build for” are also set correctly. I’d say I’ve followed the steps provided by Xojo, so I’ve no further clue.

Help, please.

First I’d say, delete the app from the iPad and try again. If you have any other debugged apps on the device that might have the same bundle identifier, delete those too.

After that, did you get the dialog on the first debug that talks about the network connection? (I can’t remember the exact words) make sure you touch “yes” on that dialog and then stop the debugger and run again.

Beyond that, it’d be helpful to know what version of macOS is on your Mac and what version of iOS is on your iPad.

Sorry, I forgot to mention I tried that already.

I did, although it was months ago (when I launched the built app for the first time, IIRC).

Mac is 12.6 and iPad is 15.6.1.

Thanks.

If that’s the case (a few months ago) then you’re not completely removing the app from your phone when you delete it. That dialog will appear every time you completely remove it. Please try again just to make sure.

You have to wait for iPadOS 16 with xcode sdk 14 or use xcode sdk 13.x to run on older iOS/iPadOS.
Check this using Xcode preferences → Locations → sdk tools selector

The way I’m doing it (which I just did yesterday) is the following:
• At the home screen, I hold my finger on the app. A menu then appears.
• I choose the option to remove the app in the menu.
• I confirm I’m sure I want to remove the app.

Am I doing it wrong?

While I’ve not found a “sdk tools” selector there, there’s a “command line tools” option, but I can’t go anywhere other than 14:
image

Is that normal?

Thanks.

yes unless you’ve re-installed the older xcode 13.x
I think xojo* needs to release faster (for fixes) since nobody ever hold the old version, heck i can’t even find it. And auto-update is always on since there are important updates.

For now you can only build for ios 16.x and later or re-download xcode 13.x (wherever it may be).

  • it looks like the xojo builds are never backwards compatible …?

I made the mistake to buy my Mac with a too-small drive (I didn’t expected to do so many things on it at the time of purchase, and an Apple hard disk is easily expensive). I don’t think I can afford to install two XCode apps (the apps alone would be OK, as I’d store one (or both) on an external drive, but the support files can’t be there).

Why is it it looks I’m the only one with this issue (per my search results) if this is a widespread problem?

It’s curious my iPad is still using iOS 15, though. I regularly check fo updates…
I’ll check again today.

Thanks.

Edit: I checked and it doesn’t find the iOS 16 update (I’m sure it’s compatible). Just another time where components and softwares can’t work together…

Just to be clear, I’m using 2022r2 with Xcode 14 and iOS 12, 15 and 16 just fine, so I don’t think it’s that.

The fact that it builds, transfers and launches means that everything is almost right, but that it’s crashing at the last moment.

If you connect the phone to Xcode, are you able to grab the crash log for your app?

The iPados update comes later this year

While i think xojo should investigate since this happens every update of xcode.

While I understand that this happens for some users, it doesn’t happen to all of us so it may not be a Xojo problem.

Strange that we require an OS that is not yet available :thinking:

How many users make it enough to be a concern for Xojo?

1 Like

All I’m saying is that it may not be something that they need to fix. In my experience, connection issues like this are caused by your certificates or profiles not being exactly right.

Derk is incorrect. There’s no requirement for iOS 16. In fact, you should be able to debug on any platform supported by Xcode (13 - 16) at this point.

1 Like

Have you tried making a new empty project with your apps bundle identifier to see if that launches?

So just to test, I just erased and reset my iPad and reinstalled 15.7. Here’s what I had to do to get it to work with Xojo:

  1. Downloaded and installed iOS 15.7 from Apple’s developer website. You don’t need to do this if your device is already running 15.7, but mine was running the 16.1 beta.
  2. On the device, turn on Developer Mode in Settings > Privacy & Security
  3. Connect the device to my mac via USB
  4. Launch Xcode, Open Window > Devices and Simulators and select the iPad in the list (it’ll tell you that it’s preparing the device for debugging. you need to wait for this to finish)
    4.1 If you want to use WiFi debugging, check the box that says “Connect via Network” (it can be done, but it takes a lot longer to transfer)
  5. In Xojo, select Project > Run On > (your device at the top of the list)
  6. On the device, you’ll get a prompt that looks like this, you must click “Allow”. This will happen whenever you first transfer the app to your device.

IMG_0362 2

  1. Go back to Xojo. Stop the debugging process and select Project > Run (CMD-R)

If the app launches to the point of showing a white screen and then immediately goes away, that means it’s crashing on launch. The most common reasons for a crash at this point (assuming a simple app works just fine) are:

  1. An incorrect Declare
  2. Incorrect Declare usage
  3. A missing plist entry for a feature in your app

Regarding that last one, anything that Apple thinks requires a security message for the user or an entitlement of some sort will need to be specified in your app’s plist or entitlements file. Many of the common items are already included in the Xojo IDE in the Advanced tab of the iOS build target:

If you are using any of these items in your app, be sure to enable it here and if there’s an Options button next to it, click the button and set the items inside. For instance, Camera Access has a single text field inside which is required to be set for your app to launch on a device.

Just to be clear, you can see what the cause of a startup crash is by going to Xcode, Window > Devices and Simulators, select your device, click “View Device Logs”

image

…and then find the most recent crash log for your app in the list (be patient, if there are a lot of logs, the window will take some time to populate). the reason for the crash can usually be found in the first 25-50 lines of the crash log.

2 Likes

More Information: I was able to replicate the issue you described earlier today for about 15 minutes. My iPad was having some sort of connectivity issue where the network connection kept dropping. Restarting the iPad fixed the issue for me.

I’ve finally had time to test your suggestions (sorry, I have been busy).

I first tried your suggestion, but with a dummy identifier (ending with .test). I got the exact same behaviour (white screen, then black, then “can’t connect to the debugger”). I deleted the app on the iPad and tried again, this time with the same identifier as the real app. Here, Xojo says “Compilation of “test” failed. An error occurred when attempting to launch the application. Please make sure the device stays awake and unlocked.”.

I don’t have this. In Settings, I have “Privacy” (not “Privacy & Security”) and in there, no developer mode setting.

I’m not getting to this point.

The white screen stays for several seconds, and is then replaced by a black screen, also for several seconds.

There’s no crash log for my app there (“afcd” and “backboardd” are the only processes mentioned for this morning). Looks like it’s not actually a crash… :thinking:

OK. My iPad is in airplane mode; no wifi involved (only USB cable).
Looks like there are several ways to trigger the same issue.

Thanks a lot for your help so far.