2010-07-30 10 views

Répondre

3

Dans iOS4, applicationWillTerminate n'est normalement pas appelée pour les applications qui prennent en charge l'exécution en arrière-plan. C'est peut-être la raison pour laquelle vous avez un problème.

Si vous avez ce désactivé, vous pouvez enregistrer vos objets à écouter la notification UIApplicationWillTerminateNotification, et/ou remplacer le -applicationWillTerminate du délégué de l'application: méthode et y mettre votre code:

//set up this class as an observer of UIApplicationWillTerminateNotification 
//so we can intervene when the app is about to exit. 
[[NSNotificationCenter defaultCenter] 
         addObserver:self 
          selector:@selector(applicationWillTerminate:) 
           name:UIApplicationWillTerminateNotification 
           object:[UIApplication sharedApplication]];