Debug app doesn't make it to the Simulator

I have a mobile app that I did a basic prototype that used arrays to store data, and now I have moved data storage to a sqlite db. The app would launch and run just fine in the simulator at the prototype stage, but after the conversion to the db i get the following error from Xojo when it’s run:

An error occurred when attempting to launch the application. You may need to delete the application from the simulator if it already exists.

There are no compile errors, and the simulator launches, but the app never makes it to the simulator. There were substantial code additions while moving the db, but it’s all code to get the data in/out of the db. I didn’t introduce any new UI elements to the app. The example Xojo iOS apps run just fine in the simulator, so I guess I did something in the code.

The only thing I can think of is the sqlite db file is located in a custom folder in SpecialFolder.ApplicationSupport. On first run I create the custom folder and the db file. But that code never executes because the app never makes it to the Simulator.

I have the latest Xojo, the latest Xcode and the latest Simulator versions.

The app might be crashing upon opening.

Did you try placing some break points in App.Opening event to see if the event is fired?

Crash reports from the simulator are stored here:


I guess you tried deleting the app from the simulator or even erasing all contents and settings from the simulator.

I’ll try putting a breakpoint in App.Opening, but the app never even makes it to the simulator.

I’ll also take a look at the log files. Maybe there is a clue in there.

I solved a similar problem this week which might give a clue to your issue. My problem was this:

  • I had an iOS app and a macOS app that were sharing a custom class.
  • On macOS, everything worked fine, but on iOS the app would immediately crash.
    • The simulator gave no apparent indication that the app had “made it” there.
    • But my DebugLog window DID show some of the output from the app followed by “iOS app ended” (or something like that).

Long-and-short: the crash was actually being caused by the System.DebugLog() function.

  • One of my functions assigned a MemoryBlock variable to a String, relying on implicit data type conversion (perhaps not the best approach).
  • For example:
thisStringVar = thisMemoryBlockVar
System.DebugLog(“This string var is now: “ + thisStringVar)

On macOS, the implicit conversion happens without issue, and System.DebugLog() outputs fine.
- On iOS, the implicit conversion causes System.DebugLog() to HARD-CRASH the app.

I solved this by simply adding “.ToText” to “thisStringVar” … e.g.:

System.DebugLog(“This string var is now: “ + thisStringVar.ToText)

Perhaps your iOS crash is also related to some implicit data type conversion that is not being caught (?). Just throwing out a possibility.

Did you happen to upgrade Xcode recently? I’ve been finding that debugging only works in certain configurations since I upgraded.

I didn’t upgrade intentionally. There might have been an automatic update, but I don’t think so. I got a new M2 MacBook about a month ago and installed Xcode then.

Are you able to debug on-device?

Sorry its taken a bit to get back to this.

I put a breakpoint in the Opening event - it never gets there.

I reset the Simulator using Device->Erase all Content and Settings - No change.

I looked in ~/Library/Logs/CoreSimulator/CoreSimulator.log and found this:

Jul 30 18:18:43 [MyComputerName][22648] : installApplication:withOptions:error:: Error Domain=NSPOSIXErrorDomain Code=22 “Invalid argument” UserInfo={bundleURL=file:///Users/cliff/Dev/Rehab%20Estimator%20Mobile/, NSLocalizedDescription=Simulator device returned an error for the requested operation., NSLocalizedRecoverySuggestion=Ensure your bundle contains a CFBundleVersion., NSUnderlyingError=0x6000003f3810 {Error Domain=NSPOSIXErrorDomain Code=22 “Invalid argument” UserInfo={bundleURL=file:///Users/cliff/Dev/Rehab%20Estimator%20Mobile/, NSLocalizedFailureReason=The application’s Info.plist does not contain CFBundleVersion., NSLocalizedRecoverySuggestion=Ensure your bundle contains a CFBundleVersion., NSLocalizedDescription=Failed to install the requested application}}, SimCallingSelector=installApplication:withOptions:error:, NSLocalizedFailureReason=The application’s Info.plist does not contain CFBundleVersion.}

This confirms that the app never makes it to the Simulator. I had turned on the Auto Increment Version build setting about the time this problem surfaced, but turning it off again didn’t change anything.

That’s pretty clear.

Have you assigned a Team ID and picked development or App Store?

@Greg_O - I haven’t done any of that.

I did keep messing with the version number a little bit, and apparently setting Major, Minor, and Bug versions in the build settings to 0.0.0 is bad. Anything else seems to be good and my app launches in the Simulator.

Ok, well I suggest that you do and see if that helps. Just changing the version numbers in the IDE isn’t going to help if the IDE isn’t adding the CFBundleVersion key for some other reason.

I’d make sure you’ve got the team and build type assigned before trying to move forward.

Simply not using 0.0.0 for the version is enough to get it working again.