CallKit error UnknownCallProvider

We have an app that uses CallKit for outgoing Voip calls. One of our users started experiencing an issue, where he sometimes receives an UnknownCallProvider error from CallKit 10 seconds after the transaction request. This happens both after the app stays open for a while, and on fresh launches. A device restart didn't help as well. He is not on any other call during that time.

It seems to happen only to him, and only sometimes.

Any estimation what could be the cause? Or how to find out? What are the possible reasons that produce this error?

@ozzzz Thank you so much for this great and interesting question.

A 10-second delay before an error I believe means the system accepted your transaction request, attempted to communicate with your app to execute the action, but gave up after 10 seconds because it couldn't reach the provider or didn't get a response?

If your CXProviderDelegate is set to receive callbacks on the main queue , and that queue is blocked for more than 10 seconds, the system will time out. I actually have more questions than answers, user taps "Call", you request the transaction, and then your app immediately does heavy synchronous work on the same thread CallKit is trying to use to call provider(_:perform:)? That’s the main thread, you should add an asynchronous call for that, otherwise after 10 seconds of waiting for your app's queue to free up terminates the request and throws the UnknownCallProvider error? Is that what are you seeing?

Is the app immediately suspended by the OS before the CallKit transaction can be fully processed? The user initiates a call and immediately swipes up to go to the home screen, or the device locks?

Since the issue is reproducible for this user, ask them to trigger a sysdiagnose right after the error happens. Open the logs in the Console app and filter for callservicesd. You will likely see explicit logs stating exactly why it dropped the transaction.

Albert
  Worldwide Developer Relations.

Thanks for the quick reply!

It does seem like a timeout after giving up, we don't see logs from provider(_:perform:) when this reproduces.

The app does some UI work on the main thread when starting a call, but it is all done pretty quickly (and we never experienced a case where the UI was blocked even briefly during this phase), and this user doesn't have a problem closing the call screen when he sees it doesn't connect.

The app is not suspended when the bug reproduces - the user remains on the foreground, waiting for it to connect.

I will pass the sysdiagnose instructions to the user and reply here with the results - hopefully it will answer all these questions.

Thanks!

@ozzzz Thanks for the description. This is very interesting, I wonder if there is a way to reproduce that on a small focused project so I can see what you are doing.

Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

Albert
  Worldwide Developer Relations.

We cannot reproduce it - not on any other device, and not on any of our other members on production... He isn't doing anything different than we always do when making a call, so I don't have any steps to reproduce that I can try.

I'll wait for it to reproduce on that specific member's device and have him send the logs.

@ozzzz Thanks, it sounds extremely interesting but also it seems like a device configuration issue? I would recommend to reproduce it on that device, log the time and grab the sysdiagnose, probably that file will tell you the reason for that device issue?

Looking forward to see the issue and how you resolved it. If you need us to look into the sysdiagnose we can arrange a private TSI for that. But I'm sure you'll figure it out quickly looking at the sysdiagnose.

Albert
  Worldwide Developer Relations.

CallKit error UnknownCallProvider
 
 
Q