macOS BigSur: Notarized app crashes on any account except dev account

Platform: macOS BigSur 11.1 / Xcode 12 / Swift UI 2.0


Issue Summary
  1. Notarized SwiftUI app runs fine on my dev account, even when downloaded from a website and extracted from a pkg

  2. But crashes when run on any other account--admin or standard

Details

Hi all,

I'm a first time developer and looking to distribute the app. It works perfectly fine on my macOS BigSur developer account, when either tried as a standalone .app or extracted from a dmg, but crashes on any other account when downloaded and extracted.

The app is successfully notarized using my developer account and archived for distribution.

I uploaded the app the website, downloaded it in a different admin and standard accounts on my Mac (a fresh account for testing only), the security settings have accept "App Store and identified developers" checked.

When I extract the dmg and run the app, it asks the usual gatekeeper question (do you want to open the app downloaded from the internet etc.), and then once accepted, it crashes immediately.

I'm totally at a loss. It works fine on my dev account (when I download the app etc.) but not on any other. Is it some setting on Xcode? Something else with the environment? I suspect may be a folder access issue? 

I don't know where to turn.

Another point to note

It seems some of the app is getting executed before crashing, because an app specific .json file is getting copied to the app folder, i.e. ~/Users/<user>/Library/Application Support/<app bundle path>

I'm not an experienced developer and not too bright either... need help! :) 

Any pointers and means of debugging and figuring out greatly appreciated.

Is there a way I could see my print logs in a different account without Xcode?

Crash log is attached.

:

Answered by ianhurst21 in 655177022
I figured out the issue. The culprit was a forced Swift try! which failed. It was working on my dev account because the folder/file being read from existed but didn't in other accounts.

Hard lesson learned. The crash logs, debug symbol all turned out to be useless in indicating where the issue was.
Accepted Answer
I figured out the issue. The culprit was a forced Swift try! which failed. It was working on my dev account because the folder/file being read from existed but didn't in other accounts.

Hard lesson learned. The crash logs, debug symbol all turned out to be useless in indicating where the issue was.
macOS BigSur: Notarized app crashes on any account except dev account
 
 
Q