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

How to set crop information for `thumbnailImageData` of CNMutableContact

I create/update contacts, using CNMutableContact. I can set new image via imageData property, but I need to set custom crop information for creating thumbnail. Property thumbnailImageData is read-only. Code: let cnContact =…
Igor
  • 12,165
  • 4
  • 57
  • 73
2
votes
0 answers

ios - best guess at phone number with country code

I'm trying to retrieve contacts phone numbers to be able to send SMS on behalf of a user. When the number includes the country code (ie starts with +, or 00) I'm fine. However when this is not the case, I'm trying to guess what the country code…
Guig
  • 9,891
  • 7
  • 64
  • 126
2
votes
1 answer

Swift CNContact did changed when app is not active

Update: Ok i will explain again i want to know if the phone contacts changed not my data is there a way to know if contacts were changed without looping all contacts while the app were close Notification.name.CNContactStoreDidChange work only after…
2
votes
2 answers

How to obtain Home City from Contacts Framework in iOS +9?

I am replacing my obsolete ABAdressBook code with the current CNContact framework in Objective C. I could sort out most of it, except for the Home City part, so lets focus on that. Currently I have this code: -(NSArray…
Josh
  • 6,251
  • 2
  • 46
  • 73
2
votes
2 answers

CNContact unifiedContact broken with Mac OS Sierra

Since I switched to Mac OS Sierra and XCode 8, code that was using unifiedContactsMatchingPredicate:keysToFetch:error: or unifiedContactWithIdentifier:keysToFetch:error: no longer run correctly. An error is returned : Error domain: CNErrorDomain…
AirXygène
  • 2,409
  • 15
  • 34
2
votes
2 answers

Why top Navigation Bar disappear when do some action on the view using Swift?

I have ViewController which has one button to navigate to CNContactViewController every thing works good I can go back and press the button again and so on .But my problem when I do one action on the CNContactViewController which is Share Contact…
Zizoo
  • 1,694
  • 5
  • 20
  • 42
2
votes
0 answers

Swift: didSelectContactProperty Isn't Called

I've realized that if I use the delegate method contactPicker:didSelectContact to present a custom CNContactViewController, the method contactPicker:didSelectContactProperty is no longer called. func openPicker() { let picker =…
Randoms
  • 2,110
  • 2
  • 20
  • 31
2
votes
1 answer

change title for contactsUI 'forNewContact' swift

I'm using contacts UI for adding new contact with this code let a = CNContact() let contactPickerViewController = CNContactViewController.init(forNewContact: a) // iOS Editor contactPickerViewController.delegate = self …
Aldo Lazuardi
  • 1,898
  • 2
  • 19
  • 34
2
votes
1 answer

contactPicker(_:didSelectContactProperties:) bug?

I'm trying to implement contactPicker(_:didSelectContactProperties:) method in CNContactPickerDelegate and it's not returning anything. From a UI stand point it is making the contacts list look the same as contactPicker(_:didSelectContacts:) but…
SimonBarker
  • 1,384
  • 2
  • 16
  • 31
2
votes
1 answer

Change navigation bar color of CNContactPickerViewController iOS

I've home view controller shown in image 1. When user clicks on bar button another view controller is presented using presentViewController: method. This is CNContactPickerViewController which is completely native (shown in image 2). How to…
Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
2
votes
1 answer

Is it Possible to add a custom Navigation Bar for CNContactViewController?

I want to create a custom UINavigationBar for CNContactViewController in order to select single or multiple contact. The default UINavigationBar consists of Cancel,Done and Group button which makes it look quite messy. Is there a workaround to…
Isha Balla
  • 733
  • 2
  • 9
  • 25
2
votes
1 answer

How to get contact which is lastmodified in Objective - C using CNContact?

I have fetch all contact using CNContact from device and modified but I don't get it which one is last modified...so what should I do to get info of last modified contact with it's date.
Vivek Goswami
  • 432
  • 3
  • 16
2
votes
1 answer

ios9 CNContactUI imageData

I want to set Contact IconImage CNMutableContact *contact = [CNMutableContact new]; NSData *myImageData = UIImagePNGRepresentation(myImg); contact.imageData = myImageData; Then, my Icon looks like this: But, I want it like this (no "add photo",…
Nine9
  • 107
  • 10
2
votes
3 answers

Access Users Contacts Phone Numbers CNContacts

I am trying to get to phone numbers of my contacts using CNContact, i want to have the number as a simple string of its didgits such as "04xxxxxxxx" but the closest I can get to is the following. ("contact" is of type…
Blake Lockley
  • 2,931
  • 1
  • 17
  • 30
2
votes
0 answers

Can you present another view controller on top of CNContactPickerViewController?

Whenever I try presenting a view controller overtop the new iOS 9 CNContactPickerViewController, it is immediately dismissed. Here's the relevant delegate method code: public func contactPicker(picker: CNContactPickerViewController, didSelectContact…
Aaron
  • 7,055
  • 2
  • 38
  • 53