当我通过Pusher之类的第三方客户端测试VoIP证书时,didReceiveIncomingPushWith
可以工作。但是当我使用Sinch打电话时,没有。
我按照文档进行操作,以确保正确进行了推送设置,并且还具有相应的SINManagedPushDelegate
设置:
sinchWrapper.shared.push = Sinch.managedPush(with: SINAPSEnvironment.production)
sinchWrapper.shared.push.delegate = self
sinchWrapper.shared.push.setDesiredPushTypeAutomatically()
sinchWrapper.shared.push.registerUserNotificationSettings()
func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, forType type: PKPushType) {
print("PUSH CREDENTIALS")
print(pushCredentials.token.map { String(format: "%02.2hhx", $0) }.joined())
print(pushCredentials.token)
sinchWrapper.shared.client.registerPushNotificationData(pushCredentials.token)
}
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
print("Getting push")
sinchWrapper.shared.client.relayRemotePushNotification(payload)
}
//Setup Sinch pushKit------------------------------------------
func managedPush(_ managedPush: SINManagedPush!, didReceiveIncomingPushWithPayload payload: [AnyHashable : Any]!, forType pushType: String!) {
print("Getting poush notif")
return
}
func client(_ client: SINCallClient!, localNotificationForIncomingCall call: SINCall!) -> SINLocalNotification! {
print("Getting local notif")
let notif = SINLocalNotification()
notif.alertAction = "Missed call"
notif.alertBody = "Incoming call"
return notif
}
我很确定我已经正确设置了“自此”,因为打开应用程序时会调用didReceiveIncomingCall
。
所以我的问题是,当用户A调用用户B时,我是否必须调用任何其他函数来确保在应用处于终止状态时通知用户B?简单地拨打callUser
似乎无效。