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
1
vote
1 answer

I have fetched the contact using cncontacts and able to display them on console screen, but not on table view

How to display contact in table view? I have fetched the contacts via CNContactStore iOS 9. - (void) getContacts { CNContactStore *store = [[CNContactStore alloc] init]; [store requestAccessForEntityType:CNEntityTypeContacts…
Amrut Gaikwad
  • 59
  • 2
  • 11
1
vote
1 answer

Is it necessary to ask the user for permission to access AddressBook?

I want to add a CNContactPickerViewController to my app. The user has to tap on a button and it opens up, so that he now can select a contact. If the user selected a contact, its name will be used by my program. My question: is it necessary to…
Josef Büttgen
  • 131
  • 2
  • 12
1
vote
1 answer

Fetch email address from CNContactPicker in Swift 2.0 Contact Framework iOS

I'm trying to fetch picked email address from new contact framework iOS 9 but I cannot find right solution. Phone number and name working fine. func contactPicker(picker: CNContactPickerViewController, didSelectContactProperty contactProperty:…
1
vote
3 answers

Swift Get City from Zipcode

I have a registration form the user fills out. I'd like them to only have to enter their zipcode and have my program be able to infer their city and state so they don't have to write those manually / to have a cleaner interface with fewer entry…
36 By Design
  • 3,203
  • 3
  • 18
  • 18
1
vote
1 answer

How to get the CNContact from a birthday EKEvent

From iOS 9, the EKEvent property birthdayPersonID is deprecated. How can I get the CNContact associated with a birthday event?
PatrickV
  • 1,090
  • 2
  • 9
  • 23
1
vote
1 answer

CNContact framework phonenumbers store blank

here i am trying to add new contact number from web array and there is no data enter in device CNLabeledValue *homePhone = [CNLabeledValue labeledValueWithLabel:CNLabelPhoneNumberMobile value:[CNPhoneNumber phoneNumberWithStringValue:[NSString…
Vivek Goswami
  • 432
  • 3
  • 16
1
vote
0 answers

iOS: CNContact fetching contacts using email

I have added emails to my contacts but I do not understand how I can find contacts by email. If I use Contacts app on my iPad I can type an email in the search field and it will find the contact it belongs to. What search method should I implement…
nadi9
  • 576
  • 3
  • 11
1
vote
0 answers

How to sync addressbook using contacts framework

I want to sync my contacts in my app automatically if updated in the phone contacts. for example. I have 5 contacts. if i update the mobile number of the first contact i don't want to update my database fully again. I just want to update the…
1
vote
1 answer

Custom labels associated with a contact IOS OS X Contact Framework Swift

How do I access the read-only and/or mutable contact records pertaining to what I believe to be custom labeled relationship contact data? For instance I have Daughter-In-Law, Husband or Son custom labels associated with a contact Do I need…
00Spitfire
  • 13
  • 5
1
vote
5 answers

How to add contact string from one array to another

I have a array which stores all the contacts from the phone. I have a UITableView in which i want to display all the contacts. I was having trouble displaying them in the table view o i created a new array, and used the below code to loop through…
Tejas K
  • 682
  • 11
  • 28
1
vote
1 answer

Obtaining CNContact from CNContactRelation

I am trying to obtain all related contacts to a selected contact. The way to do this seems to be via mycontact.contactRelations. This gives an array of CNLabeledValue with each of those containing a CNContactRelation as their value. There is then…
David Knight
  • 763
  • 6
  • 12
1
vote
0 answers

Unique identifiers on iOS Phonebook are not as expected

I am using the new version of retrieving contacts from the Phonebook on iOS. There is a problem with the unique identifier, which is returned by the first query. Normally the unique identifier is a UUID, but sometimes it is appended by “:…
mjrehder
  • 317
  • 4
  • 11
1
vote
1 answer

How to convert a vCard into a CNContact

I used this piece of code: var vcard = NSData() let usersContact = CNMutableContact() do { try vcard = CNContactVCardSerialization.dataWithContacts([usersContact]) } catch { print("Error \(error)") } to convert a CNMutableContact…
CoolPenguin
  • 1,215
  • 12
  • 21
1
vote
2 answers

phone number predicate on CNContactStore

I am building an app in Swift. I would like to make predicate using a phoneNumber (as String) and retrieve the name of that contact -if it exists- from the CNContactStore. I can make a name predicate fairly easily by : let pred =…
Quentin Malgaud
  • 405
  • 6
  • 21
1
vote
1 answer

Customize ContactPicker UI in iOS 9

How do I customize the UI of the CNContactPickerViewController? I want to alter the colors, fonts, and text - similar to how snapchat has done? Currently - my CNContactPickerViewController looks exactly like Apple's native contacts app.
user3298872
  • 231
  • 2
  • 10