coreTelephony
프레임 워크를 통해 수신 전화를 찾거나 탐지해야합니다. 거기에서 귀하의 AVPlayer
을 중지하기위한 귀하의 현지 통지를 시작해야합니다. 이
CTCallCenter * _callCenter = [[CTCallCenter alloc] init];
_callCenter.callEventHandler = ^(CTCall* call)
{
if ([call.callState isEqualToString:CTCallStateDisconnected])
{
NSLog(@"Call has been disconnected");
}
else if([call.callState isEqualToString:CTCallStateDialing])
{
NSLog(@"Call start");
}
else if ([call.callState isEqualToString:CTCallStateConnected])
{
NSLog(@"Call has just been connected");
}
else if([call.callState isEqualToString:CTCallStateIncoming])
{
NSLog(@"Call is incoming");
// You have to initiate/post your local notification through NSNotification center like this
[[NSNotificationCenter defaultCenter] postNotificationName:@"stopAVPlayer" object:nil];
} else
{
NSLog(@"None of the conditions");
}
};
이를 지칭 가져온 후 수행 https://developer.apple.com/library/ios/navigation/#section=Frameworks&topic=CoreTelephony
예제 코드는 해당 링크에서 누락 된 것 같습니다. AppDelegate에서 CTCallCenter를 작성하고 NSNotificationCenter를 통해 ViewController 메소드와 통신해야합니까? 아니면 View Controller에서 AVPlayer 인스턴스와 함께 생성 될 수 있습니까? – TijuanaKez