I'm developing an iOS application and I want to get a specific function to run before my app crashes (if it ever does) as a security measure.
- Is it possible to 100% of the time, run a function whenever the app is about to crash?
- If not, in which situations can I and can't I get the function to run. I.e. it can run when it's an out of memory crash, but it can't run if it's a null reference exception for example.
Specifically, I am using Betfair's API and if the app crashes I want the app to first cancel all bets with Betfair before closing the application. I realise that this may in fact be impossible due to the nature of a crash stopping the entire app.
I'm using Xamarin and C# to develop the app (in case that matters!).