callkit and contact app

Hello,

I am a developer currently working on a personal contact management app.

What is the app? My app stores additional information beyond basic contact details. Therefore, instead of using the Contacts framework, I manage contact objects using Core Data.

What am I trying to achieve? I want to display additional information on the caller ID screen when a call is received from a number stored in my app.

What have I tried? I’ve attempted the following methods without success:

1.	Call Directory Extension:

I thought using this method would allow me to display additional information from Core Data on the call screen. However, I learned that when a call is received, the iOS system first searches for the phone number in the Contacts app and only looks to the Extension app if no match is found. Therefore, displaying contact information from my app seems unfeasible. 2. Custom Call UI: Using CallKit seemed like a viable option to display the necessary information during a call, but it appears to only be possible with VoIP apps. My app does not support VoIP calls, so this method was also not implementable.

I am wondering if there are any technologies available that could help me achieve my goal, or if there’s something I might be missing. Any advice would be greatly appreciated.

Thank you!

If a similar question has been asked, I apologize for the repetition.

Answered by DTS Engineer in 809353022

According to the documentation in https://developer.apple.com/documentation/callkit/identifying-and-blocking-calls, it seems that the Call Directory is only referenced for phone numbers that are not in the system contacts. Is that correct?

Yes, that's correct. Whatever is in the Contacts database is considered the "highest priority" data, overriding any other data source. Keep in mind that I think thinking in terms of "not referencing the data" makes the issue here less obvious than it should be. If Contacts and Call Directory both have an entry for the same number, then the system has to decide which of those numbers to use. Contacts has to be the priority, since NOT using Contacts means that the user now has numbers that that can't actually name.

For example, if the system contact is saved as “Mr. Kim Minsu” but in this app, it’s saved as “Importance 5 Kim Minsu,” I want the incoming call screen to display “Importance 5 Kim Minsu” when the call is received.

In terms of the specific "system contacts" (meaning, the entries directly in the users read/write contact database), I don't see any way to do this beside directly renaming the contact through the Contacts Framework.

However, assuming these contacts are something your system has more information about (for example, a business directory), then ContactProvider might actually work pretty well for this. All contact modification would need to got through your app (ContactProvider contacts are read-only outside of your app/extension), but you'd directly control that contact card.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

First of, I want to clarify CallKit's role in the call process:

  1. Custom Call UI: Using CallKit seemed like a viable option to display the necessary information during a call, but it appears to only be possible with VoIP apps.

Fundamentally, CallKit is best understood as a narrow interface framework. That is, it doesn't "make calls” but is actually just how voip apps present and manage their out of app call interface. Our sample app for CallKit ("Speakerbox") is quite literally a "fake calling app". I actually keep a copy of it on my phone, as it works really well at this. CallKit looks so "real" that many developers assume that it does more than it actually does.

The key point here is that CallKit is the interface framework voip apps use to present their calls. CallKit calls look like Phone.app calls... because they are. Phone.app uses CallKit, just like voip apps do. However, CallKit can't be used to manipulate or modify other apps calls any more than UIKit will allow you to manipulate the interface of other apps.

I am wondering if there are any technologies available that could help me achieve my goal, or if there’s something I might be missing. Any advice would be greatly appreciated.

I don't know what modifications you're actually trying to make, but my general recommendation would be that you use CXCallDirectory, assuming the total contact count is reasonable. Strictly speaking, you could also use Live Caller ID (new in iOS 18), however, it has the same behavior as CXCallDirectory and it doesn't sound like you have enough contacts to be worth the extra effort.

Note that the behavior here is intentional:

However, I learned that when a call is received, the iOS system first searches for the phone number in the Contacts app and only looks to the Extension app if no match is found.

Doing this allows apps to provide a general directory to a broad user base, which each user can then seamlessly override without any special effort. In concrete terms, it means that when Quinn, my wife, and I work at the same company, I can install the company directory app and still get calls from "Quinn the Eskimo" and "❤️ Wife ❤️", not "Mr. Quinn Q. Quinn VII" and "Mrs. Clara Elliott".

If that doesn't work for your use case, then you could search contacts for "overlapping" contacts and modify the users actually contract entry. However, I would only do this if the specific details of your app use case mean that this is something the user will really want you to do.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Thank you for your kind response.

Let me explain what I’m trying to implement in detail.

I am creating a contact app that provides users with the ability to manage additional information (such as importance levels or complaints) for their contacts. The feature I want to implement is to display this additional information on the incoming call screen when receiving a call from someone saved in the contacts.

For example, if the system contact is saved as “Mr. Kim Minsu” but in this app, it’s saved as “Importance 5 Kim Minsu,” I want the incoming call screen to display “Importance 5 Kim Minsu” when the call is received.

According to the documentation in https://developer.apple.com/documentation/callkit/identifying-and-blocking-calls, it seems that the Call Directory is only referenced for phone numbers that are not in the system contacts. Is that correct?

I am wondering if it’s possible for my app to reference contacts in the system contacts as well.

Accepted Answer

According to the documentation in https://developer.apple.com/documentation/callkit/identifying-and-blocking-calls, it seems that the Call Directory is only referenced for phone numbers that are not in the system contacts. Is that correct?

Yes, that's correct. Whatever is in the Contacts database is considered the "highest priority" data, overriding any other data source. Keep in mind that I think thinking in terms of "not referencing the data" makes the issue here less obvious than it should be. If Contacts and Call Directory both have an entry for the same number, then the system has to decide which of those numbers to use. Contacts has to be the priority, since NOT using Contacts means that the user now has numbers that that can't actually name.

For example, if the system contact is saved as “Mr. Kim Minsu” but in this app, it’s saved as “Importance 5 Kim Minsu,” I want the incoming call screen to display “Importance 5 Kim Minsu” when the call is received.

In terms of the specific "system contacts" (meaning, the entries directly in the users read/write contact database), I don't see any way to do this beside directly renaming the contact through the Contacts Framework.

However, assuming these contacts are something your system has more information about (for example, a business directory), then ContactProvider might actually work pretty well for this. All contact modification would need to got through your app (ContactProvider contacts are read-only outside of your app/extension), but you'd directly control that contact card.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

callkit and contact app
 
 
Q