My use case is the following. After iOS app crashed I need to detect in the next application run if previous run exited due to fatal error crash and if yes then I should display some message at app launch. Is there any way in code to check if previous app run terminated due to fatal error?
To analyze this crash I'm using Crashlytics but I'm curious if there is a way to check it and react conditionally in code during app launch if previous app instance was terminated due to fatal error.
Yes, it’s totally possible to detect if your iOS app crashed the last time it ran -and since you’re already using Firebase Crashlytics, you’re in a good place. So, try to initialize this.
import FirebaseCrashlytics
if Crashlytics.crashlytics().didCrashDuringPreviousExecution() {
// Show a custom message to the user
print("Oops! Looks like the app crashed last time.")
}