[iOS VoIP通话在应用程序处于终止状态时不起作用。

问题描述 投票:0回答:1
-(无效)pushRegistry:(PKPushRegistry *)注册表didReceiveIncomingPushWithPayload:(PKPushPayload *)类型的有效载荷(PKPushType)类型,具有CompletionHandler:(void(^)(void))completion {

NSString * nameA = [NSBundle.mainBundle objectForInfoDictionaryKey:@“ CFBundleDisplayName”]CXProviderConfiguration * config = [[CXProviderConfiguration alloc] initWithLocalizedName:nameA];config.supportsVideo = FALSE;config.iconTemplateImageData = UIImagePNGRepresentation([UIImage imageNamed:@“ callkit_logo”]);

NSArray *ar = @[ [NSNumber numberWithInt:(int)CXHandleTypeGeneric] ]; NSSet *handleTypes = [[NSSet alloc] initWithArray:ar]; [config setSupportedHandleTypes:handleTypes]; [config setMaximumCallGroups:2]; [config setMaximumCallsPerCallGroup:1]; self.cxProvider = [[CXProvider alloc] initWithConfiguration:config]; NSDictionary *dict = [payload.dictionaryPayload objectForKey:@"aps"]; NSString * callm = [dict objectForKey:@"callfrom"]; if (callm.length ==0) { callm = @"CALL BB"; } CXHandle *callHandle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:callm]; CXCallUpdate *callUpdate = [[CXCallUpdate alloc] init]; callUpdate.remoteHandle = callHandle; callUpdate.supportsDTMF = YES; callUpdate.supportsHolding = YES; callUpdate.supportsGrouping = NO; callUpdate.supportsUngrouping = NO; callUpdate.hasVideo = NO; self.uuid = [NSUUID UUID]; [self.cxProvider reportNewIncomingCallWithUUID:self.uuid update:callUpdate completion:^(NSError *error) { NSLog(@"error1 ----> %@",error); if (error) { if (@available(iOS 13.0, *)) { [self.cxProvider reportCallWithUUID:self.uuid endedAtDate:[NSDate now] reason:CXCallEndedReasonFailed]; } else { } } }]; CXCallController *callController = [[CXCallController alloc] initWithQueue:dispatch_get_main_queue()]; dispatch_async(dispatch_get_main_queue(), ^{ CXEndCallAction *endCallAction = [[CXEndCallAction alloc] initWithCallUUID:self.uuid]; CXTransaction *transaction = [[CXTransaction alloc] initWithAction:endCallAction]; [callController requestTransaction:transaction completion:^(NSError *error) { NSLog(@"error2 ----> %@",error); if (@available(iOS 13.0, *)) { [self.cxProvider reportCallWithUUID:self.uuid endedAtDate:[NSDate now] reason:CXCallEndedReasonRemoteEnded]; } else { } }]; }); [self processPush:payload.dictionaryPayload]; dispatch_async(dispatch_get_main_queue(), ^{completion();}); }

---(void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void(^)(void))completion {NSString ...
xcode voip ios13 callkit pushkit
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.