Я столкнулся с проблемой, так как вызов не подключен , но это уведомление интерфейса пользователя CallKit (или как оно называется) остается в фоновом режиме, и я не могу убить его.Очевидно, что я не могу позвонить performEndCallAction
, так как cal не подключен, и я не могу получить uuid вызова.
Как еще убить / отклонить это?
Следующее моекод действия начального вызова.
При возникновении ошибки регистрируется следующее:
callButtonTapped
Выполнение вызова
2019-01-13 20: 36: 40.739368+0000 [6789: 930051] Успешный запрос транзакции StartCallAction
Перед отчетомCall
После отчетного вызова
// 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")
}
}
