Contacts

RSS for tag

Access the user's contacts and format and localize contact information using Contacts.

Posts under Contacts tag

195 Posts

Post

Replies

Boosts

Views

Activity

Sorting Contacts
I am using the Contacts API for my iOS app to fetch contacts. I currently sort the fetched contacts alphabetically, but was wondering if there is any ability to rank and sort them by "highest interaction" (i.e. scan iMessage or phone call log to prioritize contacts)? Any insight would be appreciated. I don't think this is possible via the Contacts API from what I've read, and I haven't found any existing answer commenting on this.
1
0
1.1k
Aug ’22
CNContacts framework issues
Hey everyone, I'm having trouble finding answers to a few things that the documentation seems to be a little sparse on. I've outlined 3 major ones below: Under what circumstances do contacts get unified automatically? I've tried creating duplicate contacts and adding duplicate contacts on different containers but they are never unified automatically. Is there a way to link contacts programmatically? Since the unification process doesn't seem to be consistent we're hoping to be able to do this programmatically. Can I add a CardDAV account programmatically? I want to make it easier for my users to add an external contacts account without telling them to go to Settings > Contacts > Accounts > Add Account > Other > etc. I've noticed the upcoming changes in the iOS Beta for contact management and cleanup. Do these include any more automation or detection for Unified Contacts?
1
0
666
Jul ’22
VCard File Photo URI Support
I love how Apple products will open up a VCF File in the Contacts App and import nearly all of the information successfully.However at the moment, the only format accepted for the PHOTO field is Base64.This can make for much larger VCF Files when the VCard Specification also includes an option for a Photo URI, allowing the data to be stored elsewhere and retrieved on opening of the VCard.It would be awesome if Apple Devices could recognize and retrieve Photos located at the VCF File's specified PHOTO URI Location to allow for more compact VCF files to be distributed in various formats.Here's an example of a VCard who's PHOTO option specifies a remote URI for the imageBEGIN:VCARDVERSION:3.0N:Gump;Forrest;;Mr.;FN:Forrest GumpORG:Bubba Gump Shrimp Co.TITLE:Shrimp ManPHOTO;TYPE=JPEG;VALUE=URI:https://upload.wikimedia.org/wikipedia/commons/8/87/My_Dog_%2861220578%29.jpegTEL;TYPE=WORK,VOICE:(111) 555-1212TEL;TYPE=HOME,VOICE:(404) 555-1212ADR;TYPE=WORK,PREF:;;100 Waters Edge;Baytown;LA;30314;United States of AmericaLABEL;TYPE=WORK,PREF:100 Waters Edge\nBaytown\, LA 30314\nUnited States of AmericaADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of AmericaLABEL;TYPE=HOME:42 Plantation St.\nBaytown\, LA 30314\nUnited States of AmericaEMAIL:forrestgump@example.comREV:2008-04-24T19:52:43ZEND:VCARDThank you!
6
3
12k
Jul ’22
Determining whether a vCard has a duplicate on a current iOS device?
What criteria does Apple use to determine whether a vCard sent for example as an email attachment has a duplicate? I would think there has to be more in common between the duplicates than just the given name and the family name? Does Apple say whether the given name, family name, and address enough similarities to consider two contacts duplicates of each other?
1
0
640
Jun ’22
Contacts API Silent Failures
We’ve been attempting to reliably update contacts in iCloud and Gmail containers. Having tried several approaches (bulk writes, batched writes, one-by-one writes with sleeps in between, etc.), we’ve found flakiness in all approaches that is never exposed to the app. Diving a little deeper, we’ve found that this appears to be due to internal server-client failures between iOS and the relevant CardDAV servers. From our analysis, we seem to be seeing 2 key types of failure: When the client-server interaction is interrupted, contact update requests appear to be discarded and not resumed for whichever container was currently in progress. After a variable period of time, the server wipes the newer client state and reverts to an older, stale state. We’re trying to understand if there is something we are doing wrong with our writes or if this is an iOS level bug. This is easily reproducible for any device connected to an iCloud or Gmail account with circa. 100+ contacts: for each container for each contact in container create CNSaveRequest update any field in contact and add to save request execute save request
0
5
883
Jun ’22
How do I update CloudKit whenever there is a change in Contacts in iOS?
Is there any way to run code in iOS whenever new information are added to certain contacts in contact store? If I use Notifications, I would have to have a process running at all times, since contacts are able to be changed by Apple's Contacts app. I have looked at App Extensions and there are no extensions I that can be used. There is a way to run a background process but I recall that has a limited lifespan. Am I correct about this? I need to update data in CloudKit that saves contacts information that can be shared with other users using their own Apple ID's. CloudKit subscriptions notify my app when something changes in CloudKit, but I also need to update records in CloudKit when something changes in Contacts. Anyone have any ideas how this might possibly be done?
2
0
1.1k
Jun ’22
Contacts: Filter birthdays not containing year
Using: selectedContacts = contacts.filter ({ $0.birthday?.year != nil }) Code compiles but contact still shows. How to select the correct data element from the contacts birthday when it doesn’t contain a year? func contactPicker(_ picker: CNContactPickerViewController, didSelect contacts: [CNContact]) { //selectedContacts = contacts.filter ({ $0.birthday?.value(for: .year) != nil }) selectedContacts = contacts.filter ({ $0.birthday?.year != nil }) //value(for: .year) != nil })
1
0
637
May ’22
How do I convert an struct of type Data to an object of type CNGroup?
I'm having trouble converting a CNGroup object to a Data object and back to a CNGroup object. I decided to start rethinking the problem again. Somewhere along the way I decided that I should use the Data class to save a CNGroup object to CloudKit. I also learned that the field type to use in my CKRecord object would be of the type bytes. Am I correct so far? I am able to convert a CNGroup object to a Data object and back again unless I store the Data object in CloudKit and then retrieve it before I convert the Data object back to a CNGroup object, in which case I get an error when I try to access the pointee property of the typed pointer. That would be an UnsafeBufferPointer, an UnsafeMutableBufferPointer, or an UnsafePointer. I've tried a lot of different code using different ways. It is impractical to put so much code in my post. I have used the copyBytes method and the withUnsafeBytes method of the Data object. There is one simple code, and that is when I converted the CNGroup object to a Data object: func convertCNGroupToData(fromCNGroup group: inout CNGroup) -> Data { return Data(bytes: &group, count: MemoryLayout.size(ofValue: group)) } I am looking for a simple way to do what I want. I am relooking at Apple's documentation of Data and NSData. I am not able to be more specific with this question. I appreciate any effort to help me with this.
1
0
646
Apr ’22
CNContactPickerView for macOS project ?
Hello, Xcode 12 here. AddressBook labelled as deprecated but still present in Xcode 12 / Big Sur and my macOS app works fine on it. This is an app made in Obj-C that I sell on the Mac App Store since 2013, which I modernized progressively once in a while. I now want to modernize it even more and replace AddressBook with Contacts to get rid of everything labelled as deprecated. In the Xcode objects list though, I can't find the CNContactPickerView to replace the old ABPeoplePickerView, although I linked the new Contacts framework to my project. The doc says it's available in iOS and Mac Catalyst. Does it mean it won't be available for a genuine macOS project ? If this is the case, how can I proceed, or should I just keep using AddressBook as long as it works ? In this case, for how long will Apple allow developers to use it ? Thank you.
1
0
1.4k
Apr ’22
Contacts Framework CNFetchResult
Anyone ever use CNFetchResult successfully? I find nothing on the internet, on stackoverflow, and in Apple Developer Forums. The only thing I have found is Apple Documentation for it. It says CNFetchResult is a Generic Class. What exactly does that mean. I found an explanation that gives its definition, but the rest of the explanation is very long winded.
10
0
1.6k
Mar ’22
iOS Contacts Framework Change History Data using Swift and Xcode 13
On Apple's documentation of the Contacts Framework for iOS and Swift on their developer website, there is a section called Change History Data. It consists of a list of classes and one protocol. The protocol seems to be the most important item of the list - the CNChangeHistoryEventVisitor protocol. The protocol apparently has instance methods each of which use one of those classes listed. Where do I find documentation to use this protocol and these classes? Anyone ever use these before? Here's the list: class CNChangeHistoryAddContactEvent class CNChangeHistoryAddGroupEvent class CNChangeHistoryAddMemberToGroupEvent class CNChangeHistoryAddSubgroupToGroupEvent class CNChangeHistoryDeleteContactEvent class CNChangeHistoryDeleteGroupEvent class CNChangeHistoryDropEverythingEvent class CNChangeHistoryEvent class CNChangeHistoryFetchRequest class CNChangeHistoryRemoveMemberFromGroupEvent class CNChangeHistoryRemoveSubgroupFromGroupEvent class CNChangeHistoryUpdateContactEvent class CNChangeHistoryUpdateGroupEvent protocol CNChangeHistoryEventVisitor
3
0
1.9k
Mar ’22
What to use instead of the deprecated ABAddressBookRegisterExternalChangeCallback(::_:) function?
I found information about the ABAddressBookRegisterExternalChangeCallback(::_:) function of the Address Book Framework, but that function has been deprecated, and only works with iOS 2.0–9.0. I don't see a function in the Contacts Framework that does what that function does. Is there some way that the Contacts Framework could do something that this function provided a solution for?
1
0
1.1k
Mar ’22
Contact Note Field Access Entitlement Location?
Hello Everyone, I requested for the Contact Note Field Access Entitlement here : https://developer.apple.com/contact/request/contact-note-field It was Approved I created a new provisioning profile and I can see that I have got the access for Notes filed, in the provisioning profile details. But when I try to fetch all Notes field it gives me error : Unauthorized Keys Can someone please tell me where is the Entitlement file location ? Or do I have to create one ? Apple told me to wait 2 to 3 days and it will appear in my Account, but they did not specify the exact location? Where in the account do I have to look for it?
3
0
2k
Mar ’22
How do I run code in the background in iOS that will always run?
Is there a way to put code in iOS that is always watching in the background for the contact store to change? If I put it in my app, then the user can close the app, and the app won't receive notifications when the contact store changes? Is there an app extension I can use that would allow me to do this, whether that is the intent of the extension or not?
1
0
2.2k
Mar ’22
Why this error in xcode? "Provisioning profile "MyApp_Distribution" doesn't include the com.apple.developer.contacts.notes entitlement."
I had requested for Contact Note Field Access Entitlement (via https://developer.apple.com/contact/request/contact-note-field) and got it enabled in app id's additional capabilities section. I have created app store distribution provisioning profile using this app id. And also added "com.apple.developer.contacts.notes YES" in entitlements file. But I'm getting the below error in xcode. I'm not able to archive the build because of this. How can I resolve this issue?
2
0
1.4k
Mar ’22
Sorting Contacts
I am using the Contacts API for my iOS app to fetch contacts. I currently sort the fetched contacts alphabetically, but was wondering if there is any ability to rank and sort them by "highest interaction" (i.e. scan iMessage or phone call log to prioritize contacts)? Any insight would be appreciated. I don't think this is possible via the Contacts API from what I've read, and I haven't found any existing answer commenting on this.
Replies
1
Boosts
0
Views
1.1k
Activity
Aug ’22
CNContacts framework issues
Hey everyone, I'm having trouble finding answers to a few things that the documentation seems to be a little sparse on. I've outlined 3 major ones below: Under what circumstances do contacts get unified automatically? I've tried creating duplicate contacts and adding duplicate contacts on different containers but they are never unified automatically. Is there a way to link contacts programmatically? Since the unification process doesn't seem to be consistent we're hoping to be able to do this programmatically. Can I add a CardDAV account programmatically? I want to make it easier for my users to add an external contacts account without telling them to go to Settings > Contacts > Accounts > Add Account > Other > etc. I've noticed the upcoming changes in the iOS Beta for contact management and cleanup. Do these include any more automation or detection for Unified Contacts?
Replies
1
Boosts
0
Views
666
Activity
Jul ’22
VCard File Photo URI Support
I love how Apple products will open up a VCF File in the Contacts App and import nearly all of the information successfully.However at the moment, the only format accepted for the PHOTO field is Base64.This can make for much larger VCF Files when the VCard Specification also includes an option for a Photo URI, allowing the data to be stored elsewhere and retrieved on opening of the VCard.It would be awesome if Apple Devices could recognize and retrieve Photos located at the VCF File's specified PHOTO URI Location to allow for more compact VCF files to be distributed in various formats.Here's an example of a VCard who's PHOTO option specifies a remote URI for the imageBEGIN:VCARDVERSION:3.0N:Gump;Forrest;;Mr.;FN:Forrest GumpORG:Bubba Gump Shrimp Co.TITLE:Shrimp ManPHOTO;TYPE=JPEG;VALUE=URI:https://upload.wikimedia.org/wikipedia/commons/8/87/My_Dog_%2861220578%29.jpegTEL;TYPE=WORK,VOICE:(111) 555-1212TEL;TYPE=HOME,VOICE:(404) 555-1212ADR;TYPE=WORK,PREF:;;100 Waters Edge;Baytown;LA;30314;United States of AmericaLABEL;TYPE=WORK,PREF:100 Waters Edge\nBaytown\, LA 30314\nUnited States of AmericaADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of AmericaLABEL;TYPE=HOME:42 Plantation St.\nBaytown\, LA 30314\nUnited States of AmericaEMAIL:forrestgump@example.comREV:2008-04-24T19:52:43ZEND:VCARDThank you!
Replies
6
Boosts
3
Views
12k
Activity
Jul ’22
How to integrate with iOS Spotlight contact search?
How to make your app show up in Spotlight’s video call option under contact search? As shown in the attached screenshot. Any tutorial is appreciated.
Replies
0
Boosts
0
Views
890
Activity
Jul ’22
Is it possible to add support for contacts "Found in..." to my app?
In the contacts app there are contacts included that include "Siri found in Mail". I have an app that includes a directory of contact information. Is it possible to include contacts found in my app to the system?
Replies
0
Boosts
0
Views
723
Activity
Jun ’22
Determining whether a vCard has a duplicate on a current iOS device?
What criteria does Apple use to determine whether a vCard sent for example as an email attachment has a duplicate? I would think there has to be more in common between the duplicates than just the given name and the family name? Does Apple say whether the given name, family name, and address enough similarities to consider two contacts duplicates of each other?
Replies
1
Boosts
0
Views
640
Activity
Jun ’22
Contacts API Silent Failures
We’ve been attempting to reliably update contacts in iCloud and Gmail containers. Having tried several approaches (bulk writes, batched writes, one-by-one writes with sleeps in between, etc.), we’ve found flakiness in all approaches that is never exposed to the app. Diving a little deeper, we’ve found that this appears to be due to internal server-client failures between iOS and the relevant CardDAV servers. From our analysis, we seem to be seeing 2 key types of failure: When the client-server interaction is interrupted, contact update requests appear to be discarded and not resumed for whichever container was currently in progress. After a variable period of time, the server wipes the newer client state and reverts to an older, stale state. We’re trying to understand if there is something we are doing wrong with our writes or if this is an iOS level bug. This is easily reproducible for any device connected to an iCloud or Gmail account with circa. 100+ contacts: for each container for each contact in container create CNSaveRequest update any field in contact and add to save request execute save request
Replies
0
Boosts
5
Views
883
Activity
Jun ’22
How do I update CloudKit whenever there is a change in Contacts in iOS?
Is there any way to run code in iOS whenever new information are added to certain contacts in contact store? If I use Notifications, I would have to have a process running at all times, since contacts are able to be changed by Apple's Contacts app. I have looked at App Extensions and there are no extensions I that can be used. There is a way to run a background process but I recall that has a limited lifespan. Am I correct about this? I need to update data in CloudKit that saves contacts information that can be shared with other users using their own Apple ID's. CloudKit subscriptions notify my app when something changes in CloudKit, but I also need to update records in CloudKit when something changes in Contacts. Anyone have any ideas how this might possibly be done?
Replies
2
Boosts
0
Views
1.1k
Activity
Jun ’22
What does CNContactStoreDidChange notification notify multiple times for a single change my app makes itself?
What does CNContactStoreDidChange notification notify multiple times for a single change my app makes itself?
Replies
0
Boosts
0
Views
642
Activity
Jun ’22
Set the ringtone for a contact programmatically
Is it possible in the SDK to set the ringtone for a contact without using the ContactUI?Thanks
Replies
1
Boosts
0
Views
923
Activity
May ’22
Contacts: Filter birthdays not containing year
Using: selectedContacts = contacts.filter ({ $0.birthday?.year != nil }) Code compiles but contact still shows. How to select the correct data element from the contacts birthday when it doesn’t contain a year? func contactPicker(_ picker: CNContactPickerViewController, didSelect contacts: [CNContact]) { //selectedContacts = contacts.filter ({ $0.birthday?.value(for: .year) != nil }) selectedContacts = contacts.filter ({ $0.birthday?.year != nil }) //value(for: .year) != nil })
Replies
1
Boosts
0
Views
637
Activity
May ’22
How do I convert an struct of type Data to an object of type CNGroup?
I'm having trouble converting a CNGroup object to a Data object and back to a CNGroup object. I decided to start rethinking the problem again. Somewhere along the way I decided that I should use the Data class to save a CNGroup object to CloudKit. I also learned that the field type to use in my CKRecord object would be of the type bytes. Am I correct so far? I am able to convert a CNGroup object to a Data object and back again unless I store the Data object in CloudKit and then retrieve it before I convert the Data object back to a CNGroup object, in which case I get an error when I try to access the pointee property of the typed pointer. That would be an UnsafeBufferPointer, an UnsafeMutableBufferPointer, or an UnsafePointer. I've tried a lot of different code using different ways. It is impractical to put so much code in my post. I have used the copyBytes method and the withUnsafeBytes method of the Data object. There is one simple code, and that is when I converted the CNGroup object to a Data object: func convertCNGroupToData(fromCNGroup group: inout CNGroup) -> Data { return Data(bytes: &group, count: MemoryLayout.size(ofValue: group)) } I am looking for a simple way to do what I want. I am relooking at Apple's documentation of Data and NSData. I am not able to be more specific with this question. I appreciate any effort to help me with this.
Replies
1
Boosts
0
Views
646
Activity
Apr ’22
CNContactPickerView for macOS project ?
Hello, Xcode 12 here. AddressBook labelled as deprecated but still present in Xcode 12 / Big Sur and my macOS app works fine on it. This is an app made in Obj-C that I sell on the Mac App Store since 2013, which I modernized progressively once in a while. I now want to modernize it even more and replace AddressBook with Contacts to get rid of everything labelled as deprecated. In the Xcode objects list though, I can't find the CNContactPickerView to replace the old ABPeoplePickerView, although I linked the new Contacts framework to my project. The doc says it's available in iOS and Mac Catalyst. Does it mean it won't be available for a genuine macOS project ? If this is the case, how can I proceed, or should I just keep using AddressBook as long as it works ? In this case, for how long will Apple allow developers to use it ? Thank you.
Replies
1
Boosts
0
Views
1.4k
Activity
Apr ’22
CNContacts framework and SmartGroups
Could someone please clarify how to access SmartGroups using the CNContacts framework?
Replies
2
Boosts
0
Views
1.2k
Activity
Mar ’22
Contacts Framework CNFetchResult
Anyone ever use CNFetchResult successfully? I find nothing on the internet, on stackoverflow, and in Apple Developer Forums. The only thing I have found is Apple Documentation for it. It says CNFetchResult is a Generic Class. What exactly does that mean. I found an explanation that gives its definition, but the rest of the explanation is very long winded.
Replies
10
Boosts
0
Views
1.6k
Activity
Mar ’22
iOS Contacts Framework Change History Data using Swift and Xcode 13
On Apple's documentation of the Contacts Framework for iOS and Swift on their developer website, there is a section called Change History Data. It consists of a list of classes and one protocol. The protocol seems to be the most important item of the list - the CNChangeHistoryEventVisitor protocol. The protocol apparently has instance methods each of which use one of those classes listed. Where do I find documentation to use this protocol and these classes? Anyone ever use these before? Here's the list: class CNChangeHistoryAddContactEvent class CNChangeHistoryAddGroupEvent class CNChangeHistoryAddMemberToGroupEvent class CNChangeHistoryAddSubgroupToGroupEvent class CNChangeHistoryDeleteContactEvent class CNChangeHistoryDeleteGroupEvent class CNChangeHistoryDropEverythingEvent class CNChangeHistoryEvent class CNChangeHistoryFetchRequest class CNChangeHistoryRemoveMemberFromGroupEvent class CNChangeHistoryRemoveSubgroupFromGroupEvent class CNChangeHistoryUpdateContactEvent class CNChangeHistoryUpdateGroupEvent protocol CNChangeHistoryEventVisitor
Replies
3
Boosts
0
Views
1.9k
Activity
Mar ’22
What to use instead of the deprecated ABAddressBookRegisterExternalChangeCallback(::_:) function?
I found information about the ABAddressBookRegisterExternalChangeCallback(::_:) function of the Address Book Framework, but that function has been deprecated, and only works with iOS 2.0–9.0. I don't see a function in the Contacts Framework that does what that function does. Is there some way that the Contacts Framework could do something that this function provided a solution for?
Replies
1
Boosts
0
Views
1.1k
Activity
Mar ’22
Contact Note Field Access Entitlement Location?
Hello Everyone, I requested for the Contact Note Field Access Entitlement here : https://developer.apple.com/contact/request/contact-note-field It was Approved I created a new provisioning profile and I can see that I have got the access for Notes filed, in the provisioning profile details. But when I try to fetch all Notes field it gives me error : Unauthorized Keys Can someone please tell me where is the Entitlement file location ? Or do I have to create one ? Apple told me to wait 2 to 3 days and it will appear in my Account, but they did not specify the exact location? Where in the account do I have to look for it?
Replies
3
Boosts
0
Views
2k
Activity
Mar ’22
How do I run code in the background in iOS that will always run?
Is there a way to put code in iOS that is always watching in the background for the contact store to change? If I put it in my app, then the user can close the app, and the app won't receive notifications when the contact store changes? Is there an app extension I can use that would allow me to do this, whether that is the intent of the extension or not?
Replies
1
Boosts
0
Views
2.2k
Activity
Mar ’22
Why this error in xcode? "Provisioning profile "MyApp_Distribution" doesn't include the com.apple.developer.contacts.notes entitlement."
I had requested for Contact Note Field Access Entitlement (via https://developer.apple.com/contact/request/contact-note-field) and got it enabled in app id's additional capabilities section. I have created app store distribution provisioning profile using this app id. And also added "com.apple.developer.contacts.notes YES" in entitlements file. But I'm getting the below error in xcode. I'm not able to archive the build because of this. How can I resolve this issue?
Replies
2
Boosts
0
Views
1.4k
Activity
Mar ’22