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.
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.
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.
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] com.apple.CoreSimulator.simctl[22648] : installApplication:withOptions:error:: Error Domain=NSPOSIXErrorDomain Code=22 “Invalid argument” UserInfo={bundleURL=file:///Users/cliff/Dev/Rehab%20Estimator%20Mobile/Rehab%20Estimator.debug.app/, 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/Rehab%20Estimator.debug.app/, 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.
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.