I want to play sound in my app (using swift) , 
in didFinishLaunchingWithOptions function I wrote this 
AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, error: nil)
AVAudioSession.sharedInstance().setActive(true, error: nil)
and I have a UIView that holds the AVPlayer.
I used:
UIApplication.sharedApplication().beginReceivingRemoteControlEvents()
self.becomeFirstResponder()
and remoteControlReceivedWithEvent function. When the app enters background, the sound continues to play, but when I click pause button (which we use to play and pause sounds from outside the app) the remoteControlReceivedWithEvent never get called! 
Whats wrong?