Questions tagged [cncontact]

CNContact is a thread-safe class for Apple architectures (MacOS, iOS, watchOS, etc.) that represent an immutable value object for contact properties, such as the first name and phone numbers of a contact.

The contact class (CNContact) is a thread-safe, immutable value object of contact properties, such as the contact’s name, image, or phone numbers. The contact class is like NSDictionary; it has a mutable subclass CNMutableContact you can use to modify contact properties. For contact properties that can have multiple values, such as phone numbers or email addresses, an array of CNLabeledValue objects is used. The labeled value class is a thread-safe, immutable tuple of labels and values. Labels describe each value to the user, allowing differentiation such as home and work phone numbers. The Contacts framework provides some predefined labels and you can create your own custom labels.

256 questions
0
votes
2 answers

Error "A promise was finished incorrectly" from CNContactStore requestAccess

I am building a UI to request access to CNContactStore and handle the case where a user has previously (and probably erroneously) denied access. When I detect that the current status is .denied, I present a UIAlertController that explains and offers…
tkhelm
  • 345
  • 3
  • 14
0
votes
2 answers

Can I use the View CNContactViewController without saving the contact to the contactStore?

I searched now for at least 2 hours and couldn't find an answer for this. I need to have an object of type CNContact. I found the CNContactViewController and this view would meet perfectly my requirements. With it I can create a new contact with…
0
votes
1 answer

Unable to remove item from CNMutableContact in Generic Function

I want to allow a user to remove elements( eg CNPhoneNumber, CNEmailAddresses) from a contact after displaying the original contact and depending on what they choose I remove from my edited contact. Even though I have a mutable contact and use…
Prasanth
  • 646
  • 6
  • 21
0
votes
1 answer

“This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread” in Swift

Im trying to fetch a users contacts. Everything works well, except for the fact that when user clicks on button to allow us to access contacts, the contacts gets printed in console, but the segue to the other viewcontroller uses alot of time, and my…
Matt Gilbert
  • 113
  • 1
  • 13
0
votes
0 answers

searching through CNContacts in table view

I have made a very simple address book which shows the picture, name and the phone number of the user. And I have implemented them in a table view, now I have added a search bar for the table and it does not behave as I want!! my table works fine.…
jack
  • 77
  • 2
  • 8
0
votes
1 answer

Not able to save a custom object array save to UserDefault in Swift 4

I have searched for around 2 days on Google and also on StackOverflow but no luck. My custom object is almost a replica of the CNContact object. struct Contact: Codable { let fullName, phones, emails: String let imageDataAvailable, expanded:…
The iOSDev
  • 5,237
  • 7
  • 41
  • 78
0
votes
0 answers

CNContact: how to know which postal address properties to display for a given country?

The goal is to create a custom form for entering contact addresses. If you edit a contact's properties with a CNContactViewController on iOS, the properties in a postal address change based on the country. For instance, Afghanistan postal addresses…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
0
votes
1 answer

CNContactViewControllerDelegate not called when contact property selected/edited on iOS

The delegate for CNContactviewController is not called when properties get edited or selected. When editing a new contact, the contactViewController(_ viewController: CNContactViewController, shouldPerformDefaultActionFor property:…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
0
votes
1 answer

ContactsUI: how to show only specific fields when creating new contact on iOS?

The goal is to present only certain fields when adding a new contact on iOS. For instance, let's assume you only want to show and edit the address, phone number, and given name for a contact. The code below doesn't work. All fields still…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
0
votes
1 answer

CNLabelPhoneNumber Label Picker

I've been looking for a solution on this for a while now and can't find a thing on implementing this (screenshot provided below). I'm creating a custom ContactsViewController which uses the CNContact framework for CRUD functionalities. All is clear…
Lysdexia
  • 453
  • 8
  • 22
0
votes
2 answers

Contact image not getting when fetch all contact list from iPhone by CNContact

I know this question already asked but not getting solution. From this code I will get all the information from the contact but image not found when open vcf files on mac os, also not getting when share this file. I use this stackoverflow link here…
0
votes
1 answer

Refreshing a CNContact with unifiedContactWithIdentifier: won't allow editing of the returned contact after contact record edited one time

steps to cause problem -edit a field in CNContact, so let's say i'm editing the email of "email home". edit works successfully - (void)doUpdateField { NSString * tempString = [[[self contentView] phoneField] text]; [self.navigationItem…
Larry Pickles
  • 4,615
  • 2
  • 19
  • 36
0
votes
1 answer

How to sync contact between Contact App and my app in CNContact framework?

I synced contacts between Contact app and my app in ABAddressBook framework compared with kABPersonModificationDateProperty. But I can't find Contact's modification property API in CNContact Framework. I have waited for iOS 12, some report it to…
dobiho
  • 1,025
  • 1
  • 11
  • 22
0
votes
0 answers

Extend or subclass CNContactViewController to multi-select with checks

I would like to be able pull up a CNContactViewController with a single contact. Within this page I want to add the functionality of multi-select so I can choose muttiple properties and as the user selects each property either highlight or place a…
0
votes
0 answers

Swift 4 vCard on touch add to contacts

I have scoured the internet looking to find a way to save a persons contact information. Currently on my mobile website I have a vCard that when clicked on a phone asks the user if they would like to add the contact to their contacts. In swift…
jfulton
  • 77
  • 1
  • 10