I am developing an iOS app with swift 3-4 and I have to know the time when my app crashed. How do I achieve that? I don't use firebase.
Asked
Active
Viewed 258 times
-2
-
you can integrate crashlytics in your application to report for crash – Sagar Bhut Nov 14 '17 at 12:58
-
What have you tried to achieve it? – Marco Pace Nov 14 '17 at 15:46
2 Answers
0
Integrate crashlytics to know about the crash, line of code that caused the crash, number of times it got crashed for the same issue etc.

Apogee
- 689
- 8
- 19
-
I already use crashlytics but I dont want to know with that. I have to know time when my app crashed in application.And then I wanna save the crash time in user pref variable. – Akif Demirezen Nov 14 '17 at 13:04
-
@AkifDemirezen May be [this](https://stackoverflow.com/a/22654228/2904573) can help. But its written in objective C – Apogee Nov 15 '17 at 13:00
-2
You may have these notifications inside UIApplicationDelegate class:
applicationDidFinishLaunchingWithOptions:
applicationWillResignActive:
applicationDidEnterBackground:
applicationWillEnterForeground:
applicationDidBecomeActive:
applicationWillTerminate:
There are also more inside here.
You can do what you want inside the implementation of these delegates, including record time. Note still you don't run short in time, some evwnta give you only limited time to react.

mico
- 12,730
- 12
- 59
- 99
-
1None of these app delegate methods have anything to do with an app crash. – rmaddy Nov 14 '17 at 15:30
-
I think it suggested to use those callbacks to save information somewhere: if the app didn't crashed then the next time you start it you will have those information saved, if it crashed you won't have those information saved. – Marco Pace Nov 14 '17 at 15:46