Reputation: 3213
I tried putting my code in the applicationWillTerminate
function of the app delegate but noticed it wasn't being called when I closed the app and then read up and found out applicationWillTerminate
is not called consistently on app close. What the heck?
Is there any way to consistently execute code on app close? It seems like a simple requirement and it is important for my project so I hope this is possible.
Upvotes: 2
Views: 151
Reputation: 131398
applicationWillTerminate
is not normally called. You get a message when your app is about to be suspended, and once that happens you can be terminated without further warning. you should treat a suspend event as a possible termination and save everything you need to save.
As I recall it is possible to get notified about UNIX SIGTERM messages, but I'm not positive.
Upvotes: 2