title: Can't beginReceivingRemoteControlEvents in iOS
body: <p>In my app i want let user to control audio playback in background. I set backGround modes in .plist, and in plays in bg just like i wanted.But i can't get any response from touching the control buttons.</p>
  
  <p>I set the <code>AudioSession</code> like this</p>
  
  <pre><code>[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
  [[AVAudioSession sharedInstance]setActive:YES error:nil];
  </code></pre>
  
  <p>Then, in viewContoller where my player is placed i <code>beginReceivingRemoteControlEvents</code> like this</p>
  
  <pre><code> if ([[UIApplication sharedApplication] respondsToSelector:@selector(beginReceivingRemoteControlEvents)]){
      [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
      [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:NULL];
      [self becomeFirstResponder];
      NSLog(@"Responds!");
  }
  </code></pre>
  
  <p>And it prints <code>Responds!</code></p>
  
  <p>But the problem is that this method is never called</p>
  
  <pre><code>    - (void)remoteControlReceivedWithEvent:(UIEvent *)event
  {
      NSLog(@"Where is my event?");
      if(event.type == UIEventTypeRemoteControl)
      {
          switch (event.subtype) {
              case UIEventSubtypeRemoteControlTogglePlayPause:
                  NSLog(@"Pause");
                  [self playWords:playButton];
                  break;
              case UIEventSubtypeRemoteControlNextTrack:
                  NSLog(@"Next");
                  [self next];
                  break;
              case UIEventSubtypeRemoteControlPreviousTrack:
                  NSLog(@"Prev");
                  [self prev];
                  break;
  
          }
      }
  </code></pre>
  
  <p>I even tried to write a category on <code>UIApplication</code> to let it become the first responder, but it doesn't help</p>
  
  <pre><code>@implementation UIApplication (RemoteEvents)
  -(BOOL)canBecomeFirstResponder
  {
      return YES;
  }
  @end
  </code></pre>
  
  <p>Why can this happen?</p>
  
  <p><strong>SOLUTION</strong>
  Here's what solved my problem <a href="https://stackoverflow.com/questions/3161635/entering-background-on-ios4-to-play-audio/3161899#3161899">Entering background on iOS4 to play audio</a></p>