I'm trying to make my app have a simple crash log feature where, when the app crashes, a small text file is created and saved in a crash log directory in the app's Documents directory. I've already got all the code working to create the file and save it, but I don't know how to run that code when the app crashes, or if that's even possible. I just want to run a quick method when the app crashes for any reason and (if possible) get some information about the error that I could put into the crash log file. How can I do this?
Method call on crash in Swift
Add a Comment