Hi there,
I've started building an iOS app a couple months ago from scratch, using iOS 15 as the deployment target.
I've finally gotten to the point where I'd like to have this tested in Test Flight, which I've done w/o issue with other apps.
The problem and my confusion is around the fact that the app will run when my device (iPhone XS) is connected via USB and I run the app in Xcode, but when I run it after deployed via AppConnect and installed via Test Flight or when exported to ipa and imported via Apple Configurator 2, the app opens for an instant and then closes.
No crash reports seem to be generated.
The best I can seem to do is open the console on the device via Xcode, filter by Errors and Faults, and try to see what might be the problem.
There's a couple things I see that make me think it's related to my problem.
These two seem likely culprits:
error 00:17:20.220010-0700 ReportCrash vm_read failed for task 14895, kr=4, start_address = 0x280c24180, end_address = 0x0
Scene FBSceneManager/sceneID:xyz.uniqeappname-default update failed: <NSError: 0x28385b960; domain: FBSceneErrorDomain; code: 1 (operation-failed); reason: "Scene update failed."> {
NSUnderlyingError = <NSError: 0x28243ff60; domain: FBWorkspaceScene; code: 1; reason: "Client process exited.">;
}
The thing is that I've googled the heck out of these, and can't find anything that might help me resolve the issue.
Here's what I've tried (not all at the same time):
- Edit the scheme so that Run uses the Release build config. I thought this might make the app crash when running locally, but no. This has no effect when running the app locally via Xcode. The app still works as expected.
- Edit the scheme so that Archive uses the Debug configuration. I thought this might give more crash detail, but no effect. App still stops and there's no crash report.
- Setting the Optimization Level under Apple Clang - Code Generation from Fastest to None. I've read that this helps some folks.
- Selectively disabling parts of the app. I've read that certain things break the app when not running locally (e.g. deprecated UISearchDisplayController, which I'm not using).
None of the above seem to have any effect at all, let alone toward resolving the issue.
I'm using the following 5 packages in the app:
- Lottie
- Amplify
- SpotifyAPI (SpotifyWebAPI by Peter Schorn)
- KeychainAccess
- Firebase
These add some additional dependencies.
One of these, swift-nio-zlib-support, which is a dependency of Starscream, apparently, shows a couple warnings, not errors at build time.
- Amplify is the ios-sdk and used for auth and storage.
- Firebase is used for notifications and is configured in the AppDelegate. Notifications work when running via Xcode.
This app also uses MusicKit iOS.
Again, everything works when running via Xcode, which is baffling.
Frankly, I'm at a loss as to how to troubleshoot this any further, so I'm hoping to get some help here.
Thanks in advance for any advice toward resolving this issue.
Okay, I tracked this down to an environment variable that was being used by the "dev" (i.e. debug) environment.
As environment variables are not available in "production" (i.e. release), this one particular variable was causing the app to just stop.
There was no message in the console log that reflected this that I could see, though there were guards that threw fatally if the environment variable was not present.
Anyhow, once this was moved to a .plist and called from there, the app loaded as expected in both dev and prod.