Sinch调用头在推送有效载荷中接收,但在调用对象中为零

时间:2018-09-04 10:34:17

标签: ios sinch callkit

我将在Sinch呼叫标题中发送呼叫者全名,以便在收到呼叫时显示在callkit本机屏幕中。

我已经检查了数据,并已在此功能的推送有效载荷中接收到数据

- (void)managedPush:(id<SINManagedPush>)managedPush
    didReceiveIncomingPushWithPayload:(NSDictionary *)payload
                              forType:(NSString *)pushType;

但是从中访问呼叫标题时

- (void)client:(id<SINCallClient>)client willReceiveIncomingCall:(id<SINCall>)call;

调用call.headers时字典是空的!

1 个答案:

答案 0 :(得分:1)

通过

拨打电话时,可以在“推送通知”中设置一些标题。
id<SINCall> call = [self.callClient callUserWithId:userid headers:header];

在接收方,在将接收到的推送通知中继到Sinch Client进行进一步处理之前。您在调用方设置的标头也将包含在查询结果中:

- (void)managedPush:(id<SINManagedPush>)unused
    didReceiveIncomingPushWithPayload:(NSDictionary *)payload
                              forType:(NSString *)pushType {

  id<SINNotificationResult> result = [SINPushHelper queryPushNotificationPayload:payload];
  if(result.isCall) {
    _callKitProvider.remoteDisplayName = result.callResult.headers[@"display_name"];
    NSLog(@"display_name: %@", _callKitProvider.remoteDisplayName);
  }
  [self handleRemoteNotification:payload];
}

我附加了一个git diff文件here,以显示在来自呼叫者的推送消息的标题中包括自定义显示名称所需的更改,并将其显示在被呼叫者设备的callkit屏幕上,该diff基于在Sinch SDK程序包的callkit示例应用程序中。