I am converting an existing VoIP application to Callkit. I have a lot of code in place but somehow when I initialize the CXProvider it will call providerDidBegin and immediately after that it will call providerDidReset. It doesn't give a reason for that. I cannot register one of my outgoing phone calls after that because my provider isn't active.
I have tried looking into certificates, settings and so on but basically I don't need more than I already have for my VoIP app it seems.
The call from CallKit calling the reset method is the following:
CallKit`__42-[CXProvider handleConnectionInterruption]_block_invoke:
When I dig deeper where it comes from, it's NSXPCConnection related. What is this connection and how do I need to set it up?
Of course there is no interruption in the connection.
This is how I initialize my Delegate:
- (id)init {
self = [super init];
self.configuration = [[ProviderConfiguration alloc] init];
self.provider = [[CXProvider alloc] initWithConfiguration:self.configuration];
[self.provider setDelegate:self queue:dispatch_get_main_queue()];
return self;
}
This is what the configuration looks like:
- (instancetype)init {
self = [super initWithLocalizedName:@"MyCompany"];
self.supportsVideo = NO;
self.maximumCallsPerCallGroup = 1;
self.supportedHandleTypes = [[NSSet alloc] initWithObjects:[NSNumber numberWithInt:(int)CXHandleTypePhoneNumber], nil];
self.maximumCallGroups = 1;
self.maximumCallsPerCallGroup = 5;
return self;
}
Both callbacks are implemented:
- (void)providerDidBegin:(CXProvider *)provider {
NSLog(@"Begun");
}
- (void)providerDidReset:(CXProvider *)provider {
NSLog(@"Reset");
}
In my case the same issue was due to missing VOIP background mode in Info.plist file
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>voip</string>
</array>
XCode 9 doesn't allow to set this background mode using the Capabilities tab for some unknown reason.
Make sure you're calling reportNewIncomingCallWithUUID:update:completion
with a valid, nonnull, UUID. Apple's current implementation calls completion with no error but no call screen is shown
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With