Possible Duplicate:
remoteControlReceivedWithEvent in AVAudio is not being called
I am trying to get remote control events to start/stop some audio my app is playing, but -remoteControlReceivedWithEvent: is not getting called. My app has a tab bar that switches among multiple views, if that makes any difference.
The view controller for each view implements the setup per Apple docs on using remote control events (https://developer.apple.com/iphone/library/documentation/EventHandling/Conc eptual/EventHandlingiPhoneOS/RemoteControl/RemoteControl.html#//apple_ref/d oc/uid/TP40009541-CH7-SW1). I have copied those bits below for reference.
Any ideas on why -remoteControlReceivedWithEvent: is not getting called? Should I be implementing it on another object in the responder chain?
steve
- (BOOL) canBecomeFirstResponder
{
return YES;
}
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
}
- (void) viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[UIApplication sharedApplication] endReceivingRemoteControlEvents];
[self resignFirstResponder];
}