I have been wrestling with the build settings on Visual Studio for Mac to create a working build on iTunes Connect that doesn't crash sections of the app after I install it through Test Flight. Here's the different behavior I'm experiencing depending on the Build settings/configuration and if I'm deploying to real device or iOS Simulator:
Linker Behavior: Link All
Supported Architechture: x86_64
HttpClient Implementation: Managed
Checked: Use LLVM
Checked: 32bit float ops as 64bit
Checked: Strip native debugging symbols
Unchecked: Enabled incremental builds
Unchecked: Concurrent garbage collector
Unchecked: Enable device specific builds
Checked: Optimize PNG Images
With these settings the app works perfectly fine in RELEASE mode with the iOS Simulator.
For iPhone selected as my platform(physicsl device) - I used the exact same build settings as "Release/iPhoneSimulator"(the exception being, "Supported Architectures" since the only choice for iPhone is ARM64 and the only choice for iOS Simulator is x86_64)
The app will load fine but about half of the NavController sections I open up from the home page will crash the app. Again, the app works fine on the iOS simulator with the same release build settings.
If I check the "Enable device-specific builds" then redeploy to my phone, then it all works again! Yet there is a warning not to use this setting in release mode. Again, only checking (enabling) this box, will prevent my app from crashing in release mode on a physical iPhone.
If I do enable device-specific builds and create an bundle with those working build settings, upload to iTunes Connect and install the app on my phone through Test Flight then the same crashes will happen again.
How do you debug weird complier behavior like this in release mode. I know the app can work fine but why do I need "Enable device-specific build" turned on to make it work?
Any help would be greatly appreciated. Thank you in advance for your time.