質問

I'm trying to implement saving user's data in my application. I've created special method named saveUserInfo which is called when user logs out (and for this event everything works great just as i want it to). Also i want user's data to be saved when the app's execution is over, so i've put my saveUserInfo method into applicationWillTerminate and applicationDidEnterBackground methods. And that works partly. When i press HOME button - applicationDidEnterBackground is called and saveUserInfo works as it supposed to. But when i press "Stop the running scheme or application" button in my Xcode 4 neither applicationWillTerminate nor applicationDidEnterBackground are called so user's info is not saved. What am i doing wrong? Or maybe i'm doing everything correctly and applicationWillTerminate and applicationDidEnterBackground are not supposed to get called by pressing "Stop the running scheme or application" button in Xcode? I just can't find satisfactory answer

役に立ちましたか?

解決

The stop button in Xcode kills you app there and then. It is normal that it does not go through the usual applicationWillTerminate callback.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top