Using one example video application provided by Twilio ( VideoCallKitQuickStart ), I am trying to make an incoming call by sending a VoIP notification to the application. But the application does not call an incoming call. I also tried to keep the application open when sending VoIP notifications, and the application crashes by throwing the exception below
NSInvalidArgumentException: attempt to insert non-property list object "PKPushPayload: 0x16e44af0" for key Payload
Can someone please help me or point me in the right direction how to initiate an incoming call in an application when a VoIP notification is received.
Below is my code in ViewController.swift file
func pushRegistry(registry: PKPushRegistry!, didReceiveIncomingPushWithPayload payload: PKPushPayload!, forType type: String!) { // Process the received push self.reportIncomingCall(uuid: UUID(), roomName: "testRoom", completion: nil) } func reportIncomingCall(uuid: UUID, roomName: String?, completion: ((NSError?) -> Void)? = nil) { let callHandle = CXHandle(type: .generic, value: roomName ?? "") let callUpdate = CXCallUpdate() callUpdate.remoteHandle = callHandle callUpdate.supportsDTMF = false callUpdate.supportsHolding = true callUpdate.supportsGrouping = false callUpdate.supportsUngrouping = false callUpdate.hasVideo = true callKitProvider.reportNewIncomingCall(with: uuid, update: callUpdate) { error in if error == nil { NSLog("Incoming call successfully reported.") } else { NSLog("Failed to report incoming call successfully: \(error?.localizedDescription).") } completion?(error as? NSError) } }
ios twilio callkit twilio-api
user44776
source share