CallKit Tutorial for iOS | raywenderlich.com

Learn how your app can use CallKit for system-level phone integration and how to build a directory extension for call blocking and identification.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1276414-callkit-tutorial-for-ios

I don’t understand the outcome of the “Starting the Call” chapter.

When I run the app and make a call, in the Hotline table view screen, I see the outgoing call and the label on the right saying “Dialing…”, “Connecting…”, then “Active”. But once it’s active, there’s no sound, nothing. I don’t hear the ringtone, or the other person answering. Is this chapter incomplete?

Thanks!

@haawa Can you please help with this when you get a chance? Thank you - much appreciated! :]

How can we make real call using this App ? Is it possible or it is a framework to work with existing VOIP apps to improve UI , please advise

The purpose of this tutorial is to learn how your app can use CallKit for system-level phone integration and how to build a directory extension for call blocking and identification.

This tutorial doesn’t cover the VoIP integration itself. It covers how you can integrate with Apple dialing and calling APIs.

As it is stated on Apple documentation page, with CallKit framework you can:

“Display the system-calling UI for your app’s VoIP services, and coordinate your calling services with other apps and the system”.

So for actual calling you will need to use some VoIP APIs which is not part of CallKit.
Once you do that, you can then integrate with the iOS calling UI by using CallKit framework. This is out of scope of this tutorial.

Thanks for the clarification

I see thanks. Is it possible to programatically trigger (or make) a phone call using CallKit? From the documentation, it seems not. Can you confirm? Thanks!

Thanks for great tutorial. Actually my app using callkit to make calls but. I also wants to record those calls can i do that?

@haawa Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi, thanks for the tutorial.
I’d like to know whether is possible to keep showing the system in-call UI when the screen is not locked.

image

This ˆ screen is only shown and kept when the device screen is locked.

When device is locked and we show incoming call. native UI is shown which is fine, but how can I get know when app button pressed (bottom right button with title Hotline ) image

So is there any event fire for that button press?

Issue I am facing is with ARKit. ARKit session is unable to start when this screen appears and getting this error

2019-06-24 13:05:19.890875+0530 App[4305:1012138] [Sensor] ARImageSensor (<ARImageSensor: 0x281648cf0>) failed to start!

2019-06-24 13:05:19.891068+0530 App[4305:1012138] [Session] Session (0x10705a9d0): did fail with error: Error Domain=com.apple.arkit.error Code=102 “Required sensor failed.” UserInfo={NSLocalizedRecoverySuggestion=Make sure that the application has the required privacy settings., NSLocalizedDescription=Required sensor failed., NSLocalizedFailureReason=A sensor failed to deliver the required input.}

Any help ?

@haawa Do you have any feedback about this? Thank you - much appreciated! :]

As far as I know, there is no API to record call from Apple.

I think there should be a way to display this while phone is unlocked. But I’m unaware how to do this. If you succeed please share your knowledge.

I don’t have an answer to your question. My best guess would be that when your app is launched by pressing the “Hotline” button, you can this information as user info in one of AppDelegate callbacks. And then you will be able to change logic depending on how the app was launched.

when I click for loud speaker its active and become a disactive and I got this logs

2019-08-21 14:34:03.130631+0300 AddaIOS[2458:467985] Route change:
2019-08-21 14:34:03.130913+0300 AddaIOS[2458:467985]      Override
2019-08-21 14:34:03.131045+0300 AddaIOS[2458:467985] Previous route:
2019-08-21 14:34:03.131737+0300 AddaIOS[2458:467985] <AVAudioSessionRouteDescription: 0x10e76ada0, 
inputs = (
    "<AVAudioSessionPortDescription: 0x10e76ae40, type = MicrophoneBuiltIn; name = iPhone Microphone; UID = Built-In Microphone; selectedDataSource = (null)>"
); 
outputs = (
    "<AVAudioSessionPortDescription: 0x10e76b1c0, type = Receiver; name = Receiver; UID = Built-In Receiver; selectedDataSource = (null)>"
)>
2019-08-21 14:34:03.217922+0300 AddaIOS[2458:467985] Route change:
2019-08-21 14:34:03.218300+0300 AddaIOS[2458:467985]      CategoryChange
2019-08-21 14:34:03.218670+0300 AddaIOS[2458:467985]  New Category: AVAudioSessionCategoryPlayAndRecord
2019-08-21 14:34:03.218963+0300 AddaIOS[2458:467985] Previous route:
2019-08-21 14:34:03.219813+0300 AddaIOS[2458:467985] <AVAudioSessionRouteDescription: 0x10e323ec0, 
inputs = (
    "<AVAudioSessionPortDescription: 0x10b3ee020, type = MicrophoneBuiltIn; name = iPhone Microphone; UID = Built-In Microphone; selectedDataSource = (null)>"
); 
outputs = (
    "<AVAudioSessionPortDescription: 0x10e32eb40, type = Speaker; name = Speaker; UID = Speaker; selectedDataSource = (null)>"
)>```

@haawa Can you please help with this when you get a chance? Thank you - much appreciated! :]

Unfortunately, this code hasn’t worked anymore.

Problems:
• system call UI doesn’t show;
• CallKit can’t place the connection to the called phone.

iOS 13+ Xcode 11+

@haawa Do you have any feedback about this? Thank you - much appreciated! :]