我刚刚在我们的 VOIP 应用程序中实现了 CallKit,但我正在努力让来电 UI 显示出来。
在我的实验中,我刚刚创建了一个简单的方法来显示来电 UI,如下所示:
CXProviderConfiguration * configuration = [[CXProviderConfiguration alloc] initWithLocalizedName:@"Bitcall"];
CXProvider *callkitProvider = [[CXProvider alloc] initWithConfiguration: configuration];
[callkitProvider setDelegate:self queue:nil];
CXCallUpdate *update = [[CXCallUpdate alloc] init];
update.localizedCallerName = @"Ravadam Patel";
[callkitProvider reportNewIncomingCallWithUUID:[NSUUID UUID] update:update completion:^(NSError * _Nullable error) {
if (error) {
NSLog(@"Error: %@", error);
}
}];
一切似乎都工作正常,我实际上call received
用这段代码打印出来:
- (void)handleCall
{
self.callCenter.callEventHandler = ^(CTCall *call){
if ([call.callState isEqualToString: CTCallStateConnected])
{
//NSLog(@"call stopped");
}
else if ([call.callState isEqualToString: CTCallStateDialing])
{
}
else if ([call.callState isEqualToString: CTCallStateDisconnected])
{
NSLog(@"Call ended");
}
else if ([call.callState isEqualToString: CTCallStateIncoming])
{
NSLog(@"Call received");
}
};
}
但没有显示来电 UI。有什么我想念的吗?
谢谢