繁体   English   中英

在 iOS 13 中的 VoIP 来电呼叫失败

[英]Native cellular call fails on VoIP incoming call in iOS 13

我已经在 iOS 中使用 VoIP PushKit 实现了用于音频和视频通话的 CallKit,它在 iOS 12 和之前的版本中运行良好,并且在 Z1BDF605991920DB11CBDF850813204C4EBZ 13 中运行良好。

但它在两种情况下失败:

1)我们的应用程序在前台 state。 当蜂窝电话正在运行并收到 VoIP 推送时,呼叫套件来电屏幕会显示 5 - 10 秒,然后蜂窝电话和 VOIP 呼叫都失败并显示“呼叫失败”警报。

2)我们的应用程序在后台或被杀死 state。 当蜂窝电话正在运行并且收到 VoIP 推送时,蜂窝电话和 VOIP 电话都将失败,并显示“呼叫失败”警报。 这次没有显示来电 UI。

我在这里显示我的代码:

- (void)registerAppForVOIPPush {

    PKPushRegistry *pushRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
    pushRegistry.delegate = self;
    pushRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];
}

然后推送代表

#pragma mark PKPushRegistryDelegate ----

- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials: (PKPushCredentials *)credentials forType:(NSString *)type {

    NSString *newToken = [self hexadecimalStringFromData:credentials.token];
    //Make a note of this token to a server to send VOIP for a particular device
    NSLog(@"VOIP token ::: %@", newToken);
    _voipToken = newToken;
}

- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type {
    //available(iOS, introduced: 8.0, deprecated: 11.0)
    [self pushRegistryDidReceivedPushWithPayload:payload forType:type withCompletionHandler:NULL];
}

- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {
    //available(iOS 11.0, *)
    [self pushRegistryDidReceivedPushWithPayload:payload forType:type withCompletionHandler:completion];
}

- (void)pushRegistryDidReceivedPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {

    //Call kit configration
    CXProviderConfiguration *providerConfig = [[CXProviderConfiguration alloc] initWithLocalizedName:@"my app Call"];
    providerConfig.supportsVideo = NO;
    providerConfig.maximumCallGroups = 1;
    providerConfig.maximumCallsPerCallGroup = 1;
    providerConfig.supportedHandleTypes = [[NSSet alloc] initWithObjects:[NSNumber numberWithInteger:CXHandleTypeGeneric], nil];
    providerConfig.iconTemplateImageData = UIImagePNGRepresentation([UIImage imageNamed:@"IconMask"]);


    CXProvider *provider = [[CXProvider alloc] initWithConfiguration:providerConfig];
    [provider setDelegate:self queue:nil];

    //generate token
    NSUUID *callbackUUIDToken = [NSUUID UUID];

    //Display callkit

    NSString *uniqueIdentifier = @"Max test";
    CXCallUpdate *update = [[CXCallUpdate alloc] init];
    update.remoteHandle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:uniqueIdentifier];
    update.supportsGrouping = FALSE;
    update.supportsUngrouping = FALSE;
    update.supportsHolding = FALSE;
    update.localizedCallerName = uniqueIdentifier;
    update.hasVideo = NO;
    [provider reportNewIncomingCallWithUUID:callbackUUIDToken update:update completion:^(NSError * _Nullable error) {
        NSLog(@"reportNewIncomingCallWithUUID error: %@",error);
    }];

    if (completion) {
        dispatch_async(dispatch_get_main_queue(), ^{
            completion();
        });
    }
}

我已经完美地实现了 CXProvider 委托方法

- (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAction *)action{
    [action fulfill];
}

- (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *)action{
    [action fulfill];
}

并且还管理其他委托方法来管理调用和所有内容,并且它在所有条件下都能完美运行。

我已经使用 Google Duo、Whatsapp 和 FaceTime 等其他应用程序检查了这两个场景,它正确显示了 CallKit 而没有失败,但在我的应用程序中它失败了。 我不知道它在哪里失败。

因此,对于 iOS 13 及更高版本,我有这 2 个声明的问题。 任何帮助将不胜感激。 谢谢。

这可能是 iOS 13 错误,如果您还没有这样做,您应该向 Apple 报告。

我认为像 Whatapp(以及我开发的那个)这样的应用程序能够正常工作的原因是我们针对 iOS 12 SDK 构建应用程序。 我们这样做是因为 iOS 13 中引入的 VoIP 推送通知的限制。因此,您可以尝试在 iOS 12 iOS 12 ZF20E3C5E54C3F20E3C5E54C0AB3D375D6606FB6606FB6 之前解决该问题(至少在 2020 年 4 月之前) 希望苹果能尽快解决这个问题。

我想你可以看到关于这个问题的苹果最新视频https://developer.apple.com/videos/play/wwdc2019/707如果解决它请ping 谢谢https://github.com/saroar

@Max 我遇到了与您在 iOS 版本 13.0 到 13.2.0 中遇到的相同问题。

由于许多开发人员已向 Apple 报告此问题。 上周发布的最新iOS版本(iOS 13.2.2)解决了这个bug。 因此,现在您可以开始使用最新的 SDK 和 xCode 11.2.1,而不是从旧的 SDK 构建。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM