Sinch调用头在push有效负载中被接收,但在调用对象中是nil

问题描述 投票:0回答:1

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

我检查了数据,并在此函数的push有效负载中收到了数据

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

但是从中访问呼叫头时

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

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

ios sinch callkit
1个回答
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来显示在来自调用者的推送消息的标题中包含自定义显示名称所需的更改,并在callees设备的callkit屏幕上显示它,diff基于来自Sinch的callkit示例应用程序SDK包。

© www.soinside.com 2019 - 2024. All rights reserved.