user482594
user482594

Reputation: 17486

Is it possible to receive calls using CallKit in iOS simulator?

In iOS, one can show incoming call ui by using CallKit's reportIncomingCall.

In my case, this works as expected in physical device. My iPhone gets incoming call alert and I can either accept the call or reject the call.

However, it seems to be not working in iOS simulator. More specifically, reportNewIncomingCall method call itself succeeds, but then it gets ended immediately (I do not even get to see any call alert). In addition, func provider(_ provider: CXProvider, perform action: CXEndCallAction) gets invoked from CXProviderDelegate, which means the call has been ended.

I could not find in apple official documentation whether or not it is possible to test CallKit - reportIncomingCall in iOS Simulator.

Strangely, outgoing call with reportOutgoingCall with CXCallController seems to work fine in simulator, as I can see green status bar show up at the top of the iPhone when CXStartCallAction gets fulfilled.

So the only thing that I could not make it to work is receiving call with CallKit in iOS simulator. Is this an expected behavior?

Upvotes: 6

Views: 3307

Answers (1)

Ashraf Sabry
Ashraf Sabry

Reputation: 3182

CallKit doesn't work on iOS simulators altogether, neither receiving calls nor making calls. Starting any CXTransaction containing CXStartCallAction or CXAnswerCallAction on a simulator will fail instantly with NSError.Code value of CXErrorCodeRequestTransactionErrorUnknown (zero). You will have to use a real device to test your CallKit app.

And yes, I couldn't find this mentioned in any Apple documentation. In this article that mentions the differences between simulators and real devices, CallKit is not mentioned.

Notice also that simulators don't have the calls UI (the dial pad and recent calls)

Upvotes: 8

Related Questions