How does an app manage its own contacts?

In the documentation for the Contact Provider Extension contact provider it says

Use the Contact Provider framework if your app manages its own contacts and wants to make them available in other apps that use the Contacts framework.

But how does an app manage its own contacts? What needs to be done differently if it manages its own contacts versus managing a user's contacts? Does the user still need to grant contacts access for example?

Is there a special group/domain that should be used (how) to add app contacts?

There's no mention of any of this that I can see in the documentation for CNContact or CNContactStore.

Answered by DTS Engineer in 797619022

You’ve misunderstood the “contacts” in “manages its own contacts”. This is not referring to instances of CNContact, but to contacts in a more general sense.

Imagine you’re building an app for a popular Internet-wide email service. Your email service has an address book feature, and your users might have lots of useful contact information in that address book. A Contact Provider allows you to make that information available to all apps on iOS via the standard Contacts framework APIs.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

You’ve misunderstood the “contacts” in “manages its own contacts”. This is not referring to instances of CNContact, but to contacts in a more general sense.

Imagine you’re building an app for a popular Internet-wide email service. Your email service has an address book feature, and your users might have lots of useful contact information in that address book. A Contact Provider allows you to make that information available to all apps on iOS via the standard Contacts framework APIs.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

@Eskimo Thank you.

In the documentation it gives an example of when a Contact Provider could be used: "This allows apps like Phone and Mail to provide personal names and images for incoming calls or messages when your app knows the caller or sender."

However with that example given, an app can provide names for a call via the CallKit CallExtension, or it could provide names and images during a call via the live Caller ID lookup extension. Therefore I was wondering what a Contacts Provider brings to the table in this example, that the other two don't?

This allows apps like Phone and Mail to provide personal names and images for incoming calls or messages when your app knows the caller or sender.

In this scenario, the Contact Provider extension is providing contacts to the system so that all apps can see them. This includes Phone and Mail, but also any other app that uses Contacts.

Continuing my example from above, imagine that I’m building a mail merge app, one that has nice integration with the Contacts framework. Your Contact Provider extension would allow the user to use your email service’s contacts in my app.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Is it possible to restrict the Contact Provider Extension to provide contacts to certain applications only? Thanks.

How does an app manage its own contacts?
 
 
Q