title: iPhone: UIApplicationWillResignActiveNotification never called
body: <p>I am playing a video in a view controller. When the user hits the hardware home button and the video is currently playing the app crashes with a <code>EXC_BAD_ACCESS</code> in the simulator.</p>
  
  <p>I read that I should use the <code>applicationWillResignActive</code> message to stop the video from playing which should solve the crashing.  So I am trying to register for this notifcation with the notification center, but my selector never gets called.  What am I doing wrong?</p>
  
  <p>The following code is in my media player view controller:</p>
  
  <pre><code>- (void) playMedia {    
      NSURL *mediaUrl = [NSURL fileURLWithPath:tmpFilePath isDirectory:FALSE];
      player = [[MPMoviePlayerViewController alloc] initWithContentURL:mediaUrl]; 
      player.moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
  
      player.view.frame = self.view.frame;    
      [self.view addSubview:player.view];
  
      [[NSNotificationCenter defaultCenter] addObserver:self
                                               selector:@selector(applicationWillResignActive:)
                                                   name:UIApplicationWillResignActiveNotification 
                                                 object:nil];
  
      [player.moviePlayer play];
  }
  
  - (void)applicationWillResignActive:(NSNotification *)notification {
      // never gets called!   
      NSLog(@"resign active");
      [player.moviePlayer stop];
  }
  </code></pre>