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
12
votes
4 answers

How to open New Contact Screen Directly?

Can any one please guide me ? Is it possible to open contact screen programmatically in iOS (swift)
Bucket
  • 449
  • 3
  • 20
10
votes
2 answers

How to sort contacts using Contacts with Swift

I've read official apple documentation about sorting contacts, although I am not sure how to implement it. So, here is fetch request: let fetchRequest = CNContactFetchRequest(keysToFetch: keysToFetch) and my prefered sort order: let sortOrder =…
Xernox
  • 1,706
  • 1
  • 23
  • 37
10
votes
2 answers

How to get user sort order with CNContact API

I know that I can sort with CNContacts like this: let fetch = CNContactFetchRequest(...) fetch.sortOrder = .UserDefault The question is: how do I find what is that sort order? Apart from some hacky heuristic of examining what comes back from the…
Andrew Duncan
  • 3,553
  • 4
  • 28
  • 55
9
votes
2 answers

how to get new added contact identifier using CNContactStoreDidChangeNotification?

I want get all new added contact Identifier. Here is my code : -(void)viewWillAppear:(BOOL)animated { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addressBookDidChange:) name:CNContactStoreDidChangeNotification…
Mayuri R Talaviya
  • 613
  • 1
  • 9
  • 14
9
votes
3 answers

how to retrive all CNContactStore from device without filter

I'm trying to insert into var contacts: [CNContact] = [] the var store = CNContactStore() but I did not find the right code for this job, i found this function that I need to give that a name func findContactsWithName(name: String) { …
shaharnakash
  • 675
  • 3
  • 11
  • 39
9
votes
0 answers

How do I make the search bar work with CNContactPicker when multiple selection is enabled?

I have project that is using the new Contacts framework introduced in iOS 9 Several of my UITableView subclasses call up a CNContactPicker and I wanted to make use of the search bar that appears at the top. A couple of these views just implement…
SimonTheDiver
  • 1,158
  • 1
  • 11
  • 24
8
votes
1 answer

XCode8 Swift3 - Problems with open contact list and retrieve data by click

Currently I'm developing my first iOS App and I'm a little slow and rude about the code (it's so weird and different from java) and, if this was the only problem, with the new update, Xcode is making my code insane. I think I solved most of the…
Izahal
  • 93
  • 8
8
votes
0 answers

Could we make our own CNContainer? swift

In this below image, google and yahoo could get their own CNContainer. Could we make our own CNContainer like gmail and yahoo in these screenshot? If i could, how to do this?
Aldo Lazuardi
  • 1,898
  • 2
  • 19
  • 34
8
votes
3 answers

How to check contact source in CNContact swift?

In Contact apps there's group like "iCloud", "yahoo", "gmail". In swift, is it possible to fetch contact from gmail source only?
Aldo Lazuardi
  • 1,898
  • 2
  • 19
  • 34
8
votes
3 answers

iOS 10, call directory extension not debugged

I am working on Call directory extension with callkit. I selected Call directory extension for debug and when I run this target, no NSLog is shown. How can I debug this extension? ps : When I run this extension, Debug -> Attach to process -> no…
Lisa
  • 171
  • 7
7
votes
2 answers

How does iOS messaging apps like Viber, Telegram, WhatsApp fetch contacts so fast and efficiently

I don't know if this question qualifies to be here or not, but even after so much of research, I could not find a suitable guide for this question. I hope I get an answer here. I see that all the messaging apps like Viber, WhatsApp, Telegram fetch…
Dev_Bham
  • 97
  • 12
7
votes
2 answers

CNContacts framework possible bug with phone identifier?

Recently I have switched from old ABAddressBook framework to new CNContacts. In my project I synchronize contacts from native with my own core data contacts. For this I use contact identifier and phone identifiers to synchronize phone numbers. But I…
MegaManX
  • 8,766
  • 12
  • 51
  • 83
7
votes
0 answers

Is it possible to customize CNContactPickerViewController?

I am new to iOS development and was wondering if I can modify CNContactPickerViewController tableViewCell such that the contacts who are already using my app are shown in somewhat a different way. And add an invite button to the contacts who are not…
dev27
  • 605
  • 1
  • 7
  • 15
7
votes
3 answers

"Create New Contact" and "Add to Existing Contact" for CNContactViewController()

With ABAddressBook, when I wanted the user to be able to have the options of "Create New Contact" and "Add to Existing Contact" for a contact they hadn't seen before, I would create and present an ABUnknownPersonViewController. I can find no way to…
5813
  • 1,073
  • 3
  • 14
  • 28
7
votes
1 answer

How to get localizedstring for CNLabeledValue in swift3

In swift 2 I'm using CNLabeledValue.localizedStringForLabel(phoneNumber.label) and works fine. In swift 3 I tried this line CNLabeledValue.localizedString(forLabel: phoneNumber.label!) but got generic parameter 'ValueType' could not be inferred…
Aldo Lazuardi
  • 1,898
  • 2
  • 19
  • 34
1
2
3
17 18