gpt4 book ai didi

ios - 如何关闭 CallKit 后台绿色通知

转载 作者:行者123 更新时间:2023-11-28 05:48:55 25 4
gpt4 key购买 nike

我遇到了一个问题,因为调用未连接,但此 CallKit UI 通知(或任何它所调用的)仍保留在后台,我无法终止它。很明显,我无法调用 performEndCallAction,因为 cal 未连接并且我无法获取调用的 uuid。

还有什么可以杀死/解散它?

以下是我的开始调用操作代码。

当错误发生时,日志如下:

callButtonTapped

执行调用

2019-01-13 20:36:40.739368+0000 [6789:930051] StartCallAction 交易请求成功

在 reportCall 之前

报告电话后

// MARK: Call Kit Actions
func performStartCallAction(uuid: UUID, handle: String) {
let callHandle = CXHandle(type: .generic, value: handle)
let startCallAction = CXStartCallAction(call: uuid, handle: callHandle)
let transaction = CXTransaction(action: startCallAction)

callKitCallController.request(transaction) { error in
if let error = error {
NSLog("StartCallAction transaction request failed: \(error.localizedDescription)")

// Try ending the call if the green bar disappears
DispatchQueue.main.async {
let alert = UIAlertController(title: "Call failed", message: "Something went wrong. Please close app, restart and try again. Contact support if problem persists.", preferredStyle: UIAlertController.Style.alert)
let okAction = UIAlertAction(title: "Ok", style: UIAlertAction.Style.default) { (action) in

}
alert.addAction(okAction)
alert.view.tintColor = .purpleColour
// alert.view.layoutIfNeeded() //avoid Snapshotting error
self.present(alert, animated: true, completion: nil)
}
return
}

NSLog("StartCallAction transaction request successful")

let callUpdate = CXCallUpdate()
callUpdate.remoteHandle = callHandle
callUpdate.supportsDTMF = true
callUpdate.supportsHolding = true
callUpdate.supportsGrouping = false
callUpdate.supportsUngrouping = false
callUpdate.hasVideo = false

print("Before reportCall")
self.callKitProvider.reportCall(with: uuid, updated: callUpdate)
print("After reportCall")
}
}

Call Kit Notification

最佳答案

您必须使用 callkit 请求结束交易。这会解决你的问题

let endCallAction = CXEndCallAction(call: uuid)
let transaction = CXTransaction()
callController.request(transaction) { error in
if let error = error {
// End call transaction failed
} else {
// End call transaction succeeded. this will hide the green color bar
}
}

关于ios - 如何关闭 CallKit 后台绿色通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53639880/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com