Contacts

RSS for tag

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

Contacts Documentation

Posts under Contacts tag

39 Posts
Sort by:
Post not yet marked as solved
5 Replies
3.8k Views
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!
Posted Last updated
.
Post not yet marked as solved
0 Replies
43 Views
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?
Posted Last updated
.
Post not yet marked as solved
2 Replies
63 Views
Open an existing contact Click Edit —> Add Birthday Select Date and Save Close the contact app Come back to the same contact, the birthday is gone.
Posted Last updated
.
Post not yet marked as solved
1 Replies
97 Views
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?
Posted Last updated
.
Post not yet marked as solved
0 Replies
135 Views
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
Posted Last updated
.
Post not yet marked as solved
2 Replies
203 Views
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?
Posted Last updated
.
Post not yet marked as solved
1 Replies
117 Views
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 })
Posted Last updated
.
Post not yet marked as solved
0 Replies
142 Views
overview of the problem I'm making an app with SwiftUI. We even implemented fetching contacts using CNContactStore. The goal is to get the contacts and store them separately in CoreData. This is because you need to assign and manage attributes that are not in the default contact. class ContactStore: ObservableObject {   @Environment(\.managedObjectContext) private var viewContext   @Published var error: Error? = nil   @Published var results: [CNContact] = []       func fetch() {     do {       let store = CNContactStore()       let keysToFetch = [CNContactGivenNameKey as CNKeyDescriptor,                 CNContactMiddleNameKey as CNKeyDescriptor,                 CNContactFamilyNameKey as CNKeyDescriptor,                 CNContactImageDataAvailableKey as CNKeyDescriptor,                 CNContactPhoneNumbersKey as CNKeyDescriptor,                 CNContactImageDataKey as CNKeyDescriptor]       os_log("Fetching contacts: now")       let containerId = store.defaultContainerIdentifier()       let predicate = CNContact.predicateForContactsInContainer(withIdentifier: containerId)       let contacts = try store.unifiedContacts(matching: predicate, keysToFetch: keysToFetch)       os_log("Fetching contacts: succesfull with count = %d", contacts.count)       self.results = contacts       print(results)     } catch let error {       print("error occured! : \(error.localizedDescription)")     }   } } problem Is there a way to store the contact information in the array 'results' as CoreData? The attributes set in CoreData are 'name', 'phone', and 'company'.
Posted
by nubkordev.
Last updated
.
Post not yet marked as solved
0 Replies
146 Views
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.
Posted Last updated
.
Post not yet marked as solved
1 Replies
345 Views
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.
Posted
by Barbakan.
Last updated
.
Post not yet marked as solved
2 Replies
576 Views
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.
Posted Last updated
.
Post not yet marked as solved
1 Replies
488 Views
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
Posted Last updated
.
Post not yet marked as solved
1 Replies
320 Views
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?
Posted Last updated
.
Post not yet marked as solved
3 Replies
351 Views
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?
Posted
by Dropouts.
Last updated
.
Post not yet marked as solved
1 Replies
440 Views
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?
Posted Last updated
.