我迅速实施了VOIP。
之前它工作正常。
但是,现在它不会触发didReceiveIncomingPushWith
函数。
请找到我的配置
let config = CXProviderConfiguration.init(localizedName: "AppName")
var provider: CXProvider!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
provider = CXProvider(configuration: config)
provider.setDelegate(self, queue: DispatchQueue.main)
self.registerVOIP()
}
func registerVOIP() {
//register for voip notifications
pushRegistry = PKPushRegistry(queue: DispatchQueue.main)
pushRegistry.delegate = self;
pushRegistry.desiredPushTypes = Set([PKPushType.voIP])
}
extension AppDelegate : PKPushRegistryDelegate{
func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
}
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) {
}
}
在扩展方法中,didUpdate
可以正常工作,因为在didiFinishLoad中设置了委托
我正在使用QuickBlox进行VOIP 我检查了voip证书,一切都很好。
这里是快速添加新会话的代表
extension AppDelegate : QBRTCClientDelegate{
func didReceiveNewSession(_ session: QBRTCSession, userInfo: [String : String]? = nil) {
print(#function)
}
}
the didReceiveNewSession function is trigger when receives a new call (If the app is in foreground)
答案 0 :(得分:1)
您的代码很好,这是需要更改Quickblox服务器端代码的原因。