CallKit requestTransaction error code 2

Hello,

In production, a large number of users experience outgoing call reporting fails with the following error:

com.apple.CallKit.error.requesttransaction Code=2

The iOS version doesn't matter, errors are present in v15-26

Details

  • My CXProvider held as a global singleton, so it’s unlikely to be deinited.
  • There is no explicit call to CXProvider.invalidate() in the app.

If I manually invalidate the CXProvider, I observe the expected failure when trying to create an outgoing call (com.apple.CallKit.error.requesttransaction error 2).

However, If I recreate the CXProvider after the error, outgoing calls are reported correctly.

Many users trigger the providerDidReset delegate method (CXProviderDelegate) before this error.

According to the documentation, providerDidReset can be called by the system, and we are supposed to end all active calls, but the documentation doesn't suggest recreating the CXProvider.

Question

Should I recreate CXProvider after providerDidReset and forget about that, or could this error be caused by something else?

In production, a large number of users experience outgoing call reporting fails with the following error:

How many is a "large number"? The problem here is that what trigger this:

Many users trigger the providerDidReset delegate method (CXProviderDelegate) before this error.

...is an XPC connection failure with callservicesd, typically caused by callservicesd crashing. That's not common, so if your app is causing "frequent" resets, then that's an issue that might be worth looking into.

Moving to here:

com.apple.CallKit.error.requesttransaction Code=2

Error 2 is "CXErrorCodeRequestTransactionErrorUnknownCallProvider", which basically means callservicesd doesn't recognize your provider as "valid". Again, that's not a common failure, but it could happen if your existing provider didn't register properly if/when it reconnected.

That leads to here:

Should I recreate CXProvider after providerDidReset and forget about that, or could this error be caused by something else?

Yes, that's what I would do.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Dear Apple with regards to above - can you pls shed a light on connection between:

  • CXProvider delegate method providerDidReset
  • invalidate() method CXProvider

Questions (assuming provider and delegate are still alive and connected):

  1. if to call invalidate() then delegate gonna receive providerDidReset. Is it 100% always true?

  2. My current Xcode has line like: The provider must be invalidated before it is deallocated. So if system calls providerDidReset there is no need to call invalidate() on existing provider. Just deallocate existing and create a new one?

CallKit requestTransaction error code 2
 
 
Q