fix: rare crash at launch if the app previously crashed

This commit is contained in:
Louis Pontoise authored and lwouis committed 2020-07-30 03:44:38 +09:00
1 parent 62037a0102
commit 69168f92cd
1 file changed
+2
+2
View File
@@ -12,6 +12,8 @@ class AppCenterCrash: NSObject, MSCrashesDelegate {
// MSAppCenter.setLogLevel(MSLogLevel.none)
MSAppCenter.start(AppCenterCrash.secret, withServices: [MSCrashes.self])
MSCrashes.setDelegate(self)
// when the app starts, this code can execute before defaults are set; we pre-set this default in case
defaults.register(defaults: ["crashPolicy": "1"])
MSCrashes.setUserConfirmationHandler({ (errorReports: [MSErrorReport]) in
if Preferences.crashPolicy == .ask {
App.app.activate(ignoringOtherApps: true)