未调用 reportNewIncomingCall 完成

Sco*_*des 0 voip swift callkit

reportNewIncomingCall完成参数不会被调用,这意味着我没有得到任何反馈,为什么我的VOIP应用程序不显示呼叫接收警报。

    func reportIncomingCall(uuid: UUID, handle: String, hasVideo: Bool = false, completion: ((NSError?) -> Void)?) {
    // 1.
    let update = CXCallUpdate()
    update.remoteHandle = CXHandle(type: .phoneNumber, value: handle)
    update.hasVideo = hasVideo

    // 2.
    provider.reportNewIncomingCall(with: uuid, update: update) { error in
        if error == nil {
            // 3.
            let call = Call(uuid: uuid, handle: handle)
            self.callManager.add(call: call)
        }

        // 4.
        completion?(error as? NSError)
    }
}
Run Code Online (Sandbox Code Playgroud)

我是从Ray Wanderlich 教程中获取的

我尽可能准确地复制了代码。它适用于教程,但不适用于我的项目。

Sco*_*des 7

在此处输入图片说明

这是我没有做的......这解决了它。

  • 兄弟,你救了我的命。 (2认同)