title: iOS AVAudioSession interruption notification not working as expected
body: <p>I want to know when my <code>AVAudioRecorder</code> is inaccessible (e.g when music starts playing).</p>
  
  <p>As <code>audioRecorderEndInterruption</code> will be deprecated with iOS 9 I am focusing on <code>AVAudioSession</code>'s interruption notification (but neither is working as expected).</p>
  
  <p>The issue is that the interruption notification is never called if the app was and remains in the foreground when the interruption occurs.</p>
  
  <p>E.g: The user starts and stops playing music without moving the application into the background.</p>
  
  <p>To detect any interruptions I am using:</p>
  
  <pre><code>[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioSessionWasInterrupted:) name:AVAudioSessionInterruptionNotification object:nil];
  ...
  - (void)audioSessionWasInterrupted:(NSNotification *)notification {
      if ([notification.name isEqualToString:AVAudioSessionInterruptionNotification]) {
          NSLog(@"Interruption notification");
  
          if ([[notification.userInfo valueForKey:AVAudioSessionInterruptionTypeKey] isEqualToNumber:[NSNumber numberWithInt:AVAudioSessionInterruptionTypeBegan]]) {
              NSLog(@"InterruptionTypeBegan");
          } else {
              NSLog(@"InterruptionTypeEnded");
          }
      }
  }
  </code></pre>
  
  <p>I get <code>InterruptionTypeBegan</code> as expected, but <code>InterruptionTypeEnded</code> isn't called if the app is still in the foreground (meaning it won't be called until the app is placed in the background and back into the foreground).</p>
  
  <p>How may I receive <code>InterruptionTypeEnded</code> notification when the interruption occurs while the app is in the foreground?</p>