Description
Voip call in pushkit delegate didReceiveIncomingPushWithPayload is working fine in background state. But in killed state it is not working, the application is crashing in main.m. Even in killed state the method didReceiveIncomingPushWithPayload is not getting called.
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion
{
NSLog(@"<<<<<<<<<<<<<<************* %s",__PRETTY_FUNCTION__);
NSLog(@"payload.dictionaryPayload = %@",payload.dictionaryPayload);
NSLog(@"UTC payload.dictionaryPayload = %f",[[NSDate date] timeIntervalSince1970]);
if (type == PKPushTypeVoIP) {
//Call kit configration
CXProviderConfiguration *providerConfig = [[CXProviderConfiguration alloc] initWithLocalizedName:@"Push Voip Call"];
providerConfig.supportsVideo = NO;
providerConfig.supportedHandleTypes = [[NSSet alloc] initWithObjects:[NSNumber numberWithInteger:CXHandleTypeEmailAddress], nil];
CXCallUpdate *callUpdate = [CXCallUpdate new];
NSString *uniqueIdentifier = @"Demo call";
CXCallUpdate *update = [[CXCallUpdate alloc] init];
update.remoteHandle = [[CXHandle alloc] initWithType:CXHandleTypeEmailAddress value:uniqueIdentifier];
update.localizedCallerName = uniqueIdentifier;
update.hasVideo = NO;
NSUUID *callId = [NSUUID UUID];
CXProvider *provider = [[CXProvider alloc]initWithConfiguration:providerConfig];
[provider setDelegate:self queue:nil];
[provider reportNewIncomingCallWithUUID:callId update:callUpdate completion:^(NSError * _Nullable error) {
NSLog(@"reportNewIncomingCallWithUUID error: %@",error);
//completion();
}];
completion();
}
}
I couldn't figure out what is the problem. Please help me to figure out the issue.