2

iOS CallKitのドキュメントを確認しました。以下は、「発信コールの作成」セクションで Apple から提供されたコードです。関数startOutGoingCall()を呼び出そうとしても、何も起こりません。つまり、発信呼び出し UI が表示されません。

ネイティブの発信通話 UI をトリガーする方法を教えてください。

func startOutGoingCall(){
    let uuid = UUID()
    let handle = CXHandle(type: .emailAddress, value: "jappleseed@apple.com")

    let startCallAction = CXStartCallAction(call: uuid)
    startCallAction.destination = handle

    let transaction = CXTransaction(action: startCallAction)
    callController.request(transaction) { error in
        if let error = error {
            print("Error requesting transaction: \(error)")
        } else {
            print("Requested transaction successfully")
        }
    }
}

編集:私のコードからデリゲートメソッドを追加しました

func provider(_ provider: CXProvider, perform action: CXStartCallAction) {
        logMessage(messageText: "provider:performStartCallAction:")

        /*
         * Configure the audio session, but do not start call audio here, since it must be done once
         * the audio session has been activated by the system after having its priority elevated.
         */
        localMedia?.audioController.configureAudioSession(.videoChatSpeaker)

        callKitProvider.reportOutgoingCall(with: action.callUUID, startedConnectingAt: nil)

        performRoomConnect(uuid: action.callUUID, roomName: action.handle.value) { (success) in
            if (success) {
                provider.reportOutgoingCall(with: action.callUUID, connectedAt: Date())
                action.fulfill()
            } else {
                action.fail()
            }
        }
    }
4

1 に答える 1

9

CallKit から取得する発信 UI はありません。発信するときはアプリが開いているため、UI を表示するのはアプリです。

于 2017-01-07T16:37:36.670 に答える