EarPods toggle button event has been received on iPhone 7. But it hasn't happened since yesterday. The source code has never been changed.
The source code is roughly like this.
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];
[commandCenter.togglePlayPauseCommand addTarget:self action:@selector(onTogglePlayPause:)];
commandCenter.togglePlayPauseCommand.enabled = 1;
- (MPRemoteCommandHandlerStatus)onTogglePlayPause:(MPRemoteCommandHandlerStatus*)event {
NSLog(@"toggle event! - never called....");
return MPRemoteCommandHandlerStatusSuccess;
}
env
iphone 7 (ios 15.2)
xcode 13.1
How do I get this event?