From 69168f92cd611082be6a228a025a210d573b381c Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Thu, 30 Jul 2020 02:24:57 +0900 Subject: [PATCH] fix: rare crash at launch if the app previously crashed --- src/logic/AppCenterCrashes.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/logic/AppCenterCrashes.swift b/src/logic/AppCenterCrashes.swift index 31b331f1..446315f2 100644 --- a/src/logic/AppCenterCrashes.swift +++ b/src/logic/AppCenterCrashes.swift @@ -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)