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
66
votes
8 answers

Fetching all contacts in ios Swift?

I am aware of the ios swift has a Contacts Framework where I can fetch contacts, but I cannot find any method to fetch all the contacts together where I can access each of the contacts from that array. All methods for fetching contacts seems to…
the_naive
  • 2,936
  • 6
  • 39
  • 68
40
votes
1 answer

What is the ":ABPerson" string in CNContact identifier?

My iOS application checks the contacts from time to time and imports a new one to its own database. I checked that contact and it already exists by the identifier field, that is usually filled by UUID: CNContactStore *store = [CNContactStore…
General Failure
  • 2,421
  • 4
  • 23
  • 49
34
votes
1 answer

Error creating the CFMessagePort needed to communicate with PPT

I try to present a CNContactPickerViewController inside a SwiftUI application using the UIViewControllerRepresentable protocol. As I already read, there seems to be a known issue for this not working, but I got it working quite ok using the…
vollkorntomate
  • 638
  • 1
  • 8
  • 17
29
votes
7 answers

CNContactViewController forUnknownContact unusable, destroys interface

[Appears to be fixed in iOS 10!] So what follows applies to iOS 9 only... I have been experimenting with Apple's new Contacts framework, and I've found a huge bug in one of the three forms of CNContactViewController. It destroys the surrounding…
matt
  • 515,959
  • 87
  • 875
  • 1,141
28
votes
3 answers

CNContactStoreDidChangeNotification is fired multiple times

I am able to observe the CNContactStoreDidChangeNotification when the contact database is changed while the app is in background state. I am pretty sure that only one observer was added to NSNotificationCenter. The problem is NSNotificationCenter…
23
votes
1 answer

Contact Framework equivalent to ABAddressBook.ABAddressBookRegisterExternalChangeCallback

I am migrating an application from the deprecated Address Book Framework to the new Contacts Framework. The application utilizes ABAddressBookRegisterExternalChangeCallback to be notified when another application changes a contact. I am unable to…
me--
  • 1,978
  • 1
  • 22
  • 42
19
votes
4 answers

iOS Swift CNContactPickerViewController search contact and add to selection

I am using iOS 9 and Swift 2.2 I have implemented iOS inbuilt CNContactPickerViewController using CNContactPickerDelegate to get the contact numbers, In the CNContactPickerViewController Screen, when I click on search field on top and search for a…
Sujay U N
  • 4,974
  • 11
  • 52
  • 88
18
votes
2 answers

Which keys do I need for CNContactFormatter?

I'm trying to format a contact's name using the new CNContactFormatter. It looks like, I didn't fetch all needed name properties of the contact. Terminating app due to uncaught exception 'CNPropertyNotFetchedException', reason: 'A property was not…
flohei
  • 5,248
  • 10
  • 36
  • 61
17
votes
3 answers

IOS 13 CNContacts No Longer Working To Retrieve All Contacts

I have an app that has worked perfectly well with the CNContacts framework all the way up to IOS 12. I'm currently testing it with IOS 13 beta and its completely broken. I've checked the contacts permissions and deleted the app and re-allowed the…
Plasma
  • 2,622
  • 2
  • 20
  • 35
16
votes
4 answers

How to add new email to CNMutableContact in Swift 3?

Quickly .. I have this code to add new contact , it was working until converting my code to Swift 3 , now it accept all properties except the email I get two errors : 1-Argument type 'String?' does not conform to expected type …
Zizoo
  • 1,694
  • 5
  • 20
  • 42
15
votes
3 answers

Fetch localized phone label using Contacts frameworks

I'm trying to fetch localized phone label value using CNContact.My attampt so far: NSError *error = nil; CNContactFetchRequest *fetchRequest =[[CNContactFetchRequest alloc] initWithKeysToFetch:keysToFetch]; [addressBook…
Poles
  • 3,585
  • 9
  • 43
  • 91
13
votes
7 answers

Keyboard overlaying action sheet in iOS 13.1 on CNContactViewController

This seems to be specific to iOS 13.1, as it works as expected on iOS 13.0 and earlier versions to add a contact in CNContactViewController, if I 'Cancel', the action sheet is overlapping by keyboard. No actions getting performed and keyboard is…
13
votes
1 answer

How to add custom hidden field in ios mobile contacts by CNMutableContact?

I want to add one custom hidden field in iOS mobile contacts from my application. Is it possible to add the new hidden field with value in iOS mobile contacts? Will CNMutableContact allow me to add the new custom property?
Manikandan
  • 131
  • 4
13
votes
4 answers

Swift Using Contacts Framework, search using phone number to get Name and User Image

I have an API that returns phone numbers in format: +1415xxxxxxx (E164) Right now these numbers are put into a Cell of a UITableView and are presented as expected, however I'd like to be able to search the users contacts on the phone to see if the…
Mathew Jenkinson
  • 844
  • 2
  • 11
  • 18
13
votes
3 answers

CNContact last modified date and contacts changed

Questions: How to get the last modified date in CNContact (new apple contacts framework) ? The last modified date is not present in the list of keysToFetch I would like to fetch and update contacts that have been modified since my last fetch. How…
user1046037
  • 16,755
  • 12
  • 92
  • 138
1
2 3
17 18