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
3
votes
1 answer

Swift Using Contacts Framework, search using Identifier to match

Trying unsuccessfully to get a contact match providing contact Identifier. I desire to return contact, then to use the image associated with it. I am getting a nil match. thank you. This code I got from a demo, I'm kinda new to programming import…
Mike
  • 111
  • 9
3
votes
1 answer

How to get date added or edited contact with CNContact in Swift 3.0

I have array contacts fetched using CNContactStore. I want get date added to addressbook. But when using CNContactDatesKey, result allway is 0. I hope you help.
tam nguyen
  • 55
  • 6
3
votes
1 answer

Show edit contact in Contact UI

I'm using this to show contact detail and it has option to edit contact: let toFetch = [CNContactViewController.descriptorForRequiredKeys()] let cnContact = try contactStore!.unifiedContact(withIdentifier: contanctIdentifier, keysToFetch:…
Hamza Ansari
  • 3,009
  • 1
  • 23
  • 25
3
votes
1 answer

func contactPicker(picker: CNContactPickerViewController, didSelectContacts contacts: [CNContact])

By using this function func contactPicker(picker: CNContactPickerViewController, didSelectContacts contacts: [CNContact]) : - The user is able to select multiple contacts at the same time and return to our app at the end but I want to next time…
gunjan
  • 41
  • 4
3
votes
3 answers

How To Save a Contact Into The Contacts App in iOS - Swift

I'm trying to save a contact to the contacts app by using this code directly without requesting any permission: import Foundation import UIKit import Contacts @available(iOS 9.0, *) class OnCallEmpContact: UITableViewController { var store:…
Zizoo
  • 1,694
  • 5
  • 20
  • 42
3
votes
1 answer

preload/show data in CNContactViewController (swift)

Could we show data in ios editor/CNContactViewController instead only show blank textfields? for example, when I open CNContactViewController I want the name to be filled before user type anything
Aldo Lazuardi
  • 1,898
  • 2
  • 19
  • 34
3
votes
1 answer

contact selection not possible when using the search bar

Im using the ContactPickerViewController with CNContactPickerDelegate to get the contact numbers func contactPicker(picker: CNContactPickerViewController, didSelectContacts contacts: [CNContact]) {...} but when I try…
jerem
  • 1,016
  • 2
  • 12
  • 27
3
votes
1 answer

CNContactVCardSerialization.dataWithContacts giving exception

I'm trying to convert a CNContact array to vCard using the method CNContactVCardSerialization.dataWithContacts(). But it is giving me the following error. 2016-07-25 14:05:00.115 AddressBook-ios9[902:28918] Exception writing contacts to vCard…
haider_kazal
  • 3,448
  • 2
  • 20
  • 42
3
votes
2 answers

How to filter contacts using a set of phone numbers with CNContactPickerViewController?

I try to filter some contacts from address book with a set of existing phone numbers. CNContactPickerViewController should disable selection of these contacts when they have matching phone number from existing phone numbers. I need to use phone…
3
votes
4 answers

CNContact display name objective c / swift

I am working on app where I need to import contacts into NSMutableDictionary, but sometimes people not filling all contact details. So leaving just number or company name. Do I need to go through all contacts detail to check what field will be my…
David Chelidze
  • 1,143
  • 12
  • 19
3
votes
0 answers

Import Contacts once, after that only Update/Import Changes

I'm wondering if it's possible to import all contacts of a iPhone user once, and after that only import/update the contacts within my app after a change within the real addressbook has occurred? Currently I'm just importing the whole address book in…
seb
  • 116
  • 7
3
votes
3 answers

iOS Contacts Framework: How to fetch contacts by phone number

I have a custom User class which stores the phone number of the user. class User { let phoneNumber: String } How do I get the corresponding contact from the users contact book? I tried the following but it seems like this works just for the…
Tobias
  • 4,523
  • 2
  • 20
  • 40
3
votes
4 answers

how to fetch contact image and phone Number in my app using Objective C

I am getting the contact name from my phone. Check my code: - (void) fetchContacts { CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts]; if (status == CNAuthorizationStatusDenied || status…
Ravi Singh
  • 27
  • 1
  • 7
3
votes
1 answer

Getting all CNGroups from CNContactStore

It seems that there is no way to get the groups from a CNContactStore. The CNContactStore uses a predicate that requires the group identifier to get the group. CNContact does not have any way to find out what group it is in (that I can find). Is…
erdekhayser
  • 6,537
  • 2
  • 37
  • 69
2
votes
1 answer

Is it possible to fetch a CNContact with all keys?

I am trying to share a CNContact between users in my app. At the moment I'm using a CNContactFetchRequest to fetch the contacts and the user will select one to send. But I need to define the keys using this request. I want to share the entire…
alionthego
  • 8,508
  • 9
  • 52
  • 125