-2

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.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Akif Demirezen
  • 191
  • 1
  • 1
  • 13

2 Answers2

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
  • 1
    None 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