.plist에서 정상을 추가했습니다. http://tinyurl.com/c7e9joy iPhone이 잠겨 있거나 앱 외부에 있고 리모컨 버튼을 열었을 때 앱 로고와 제목이 표시 될 수 있지만 반응하지 마라. (나는 내 자신의 아이폰에서 테스트하고 있습니다.)iOS remoteControlReceivedWithEvent가 호출되지 않았습니다.
// Makes sure we are able to connect to the media buttons on the lock screen.
- (BOOL) canBecomeFirstResponder
{
return YES;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
}
- (void) remoteControlReceivedWithEvent: (UIEvent *) receivedEvent {
NSLog(@"REMOTE");
if (receivedEvent.type == UIEventTypeRemoteControl) {
switch (receivedEvent.subtype) {
case UIEventSubtypeRemoteControlTogglePlayPause:
[self playBtnPressed:nil];
break;
case UIEventSubtypeRemoteControlPreviousTrack:
[self skipTrack:nil];
break;
case UIEventSubtypeRemoteControlNextTrack:
[self skipTrack:nil];
break;
default:
break;
}
}
}
아직 변경되지 않았지만 전혀 이벤트를 포착하지 않는 것 같습니다. – Miko