This error only occurs in iOS 13.3.1. It does not occur on iOS 13.3.0 or earlier.
If the app is in the foreground and it calls CXCallController.request, it works fine. But once I background the app and execute 'CXCallController.request' (triggered by the headphone play button), I get the following error:
Error requesting transaction: Error Domain=com.apple.CallKit.error.requesttransaction Code=6 "(null)"
Code 6 is CXErrorCodeRequestTransactionError.Code.invalidAction
Here's a snippet of the sample code
let uuid = UUID()
let handle = CXHandle(type: .emailAddress, value: "jappleseed@apple.com")
let startCallAction = CXStartCallAction(call: uuid, handle: 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")
}
}
The same code works fine in iOS 13.3.0 and earlier regardless if the app is foreground or background. Maybe this is a 13.3.1 bug or maybe Apple implemented some security measure while apps is in the background? But I don't see it in the iOS 13.3.1 release notes.