Method call on crash in Swift

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?

Accepted Reply

Could this help you ? It describes in detail how to generate crash reports.


https://developer.apple.com/library/archive/technotes/tn2151/_index.html

Replies

Could this help you ? It describes in detail how to generate crash reports.


https://developer.apple.com/library/archive/technotes/tn2151/_index.html