I have an application that plays music and want to use lockscreen control (play/pause). With NSLog I can see that my app get's the button trigger but not theUIEventSubtypeRemoteControlTogglePlayPause.
Here's a bit of my code:
- (void)viewDidLoad {
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
}
- (BOOL)canBecomeFirstResponder {
return YES;
}
- (void)remoteControlReceivedWithEvent:(UIEvent *)receivedEvent
{
NSLog(@"REMOTE RECEIVE");
if (receivedEvent.type == UIEventTypeRemoteControl)
{
NSLog(@"received remote event");
switch (receivedEvent.subtype)
{
case UIEventSubtypeRemoteControlTogglePlayPause:
NSLog(@"toggle button received");
//[self togglePlayPauseTapped: nil];
break;
default:
break;
}
}
I get "REMOTE RECEIVE" and "received remote event" from the NSLog Output but not the line inside ...TogglePlayPause.
Any ideas?
use the case
UIEventSubtypeRemoteControlPause
UIEventSubtypeRemoteControlPlay
for iOS 7