Example:
- (void)playAction:(MPRemoteCommand *)sender {
// do something
}
- (void)func {
MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];
// crash here
[commandCenter.playCommand addTarget:self action:@selector(playAction:)];
}
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unsupported action method signature. Must return MPRemoteCommandHandlerStatus or take a completion handler as the second argument.'
https://forums.developer.apple.com/thread/121540
Fix in iOS 13:
- (MPRemoteCommandHandlerStatus)playAction:(MPRemoteCommand *)sender {
// do something
return MPRemoteCommandHandlerStatusSuccess;
}