How to know when an app has been forcefully closed by user?
how could i know App was closed by user forcefully?
"closed by user forcefully" means when App in background and user close it..
how can know this?
Thanks...
i edit my question,
i want to maintain user log, So when user click on login or logout, i done my开发者_运维百科 code over there for add log detail. but when user don't click on logout and kills app through the multitasking kill, then i can't execute logout related code. so how can i get that? and my app is background enable...
Simply, you can't (reliably), and shouldn't have to.
This may help: ApplicationWillTerminate in iOS 4.0
The closest thing to what your asking is that if your application is background enabled then the
- (void)applicationDidEnterBackground:(UIApplication *)application
will be called on the user exiting your app. Then when they actually kill it you will then receive the
- (void)applicationWillTerminate:(UIApplication *)application
The only time you should need to use this is if you are actually doing something in the background. If your app has no background use it should not need to know when the user kills it through the multitasking kill.
精彩评论