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

Contact image doesn't send when contact saved by CNContact

I've written a code that saves a contact with image. I used CNContact class to do it. It saves the contact successfully. The contact shows correctly with thumbnail in iOS's default Contact app. But my problem is that, when I share that contact via…
haider_kazal
  • 3,448
  • 2
  • 20
  • 42
4
votes
1 answer

Present EditView of Contacts in ContactsUI

I have a TableView that present a contact. When I click the cell i would like to do straight to Editable view, instead of going to the CNContactViewController and press "edit Button". Now i have the following : firstview secondview I would like…
4
votes
1 answer

CNContact.imageData don't work

I set the imageData in CNContact and save,but when I call the person who I save the headImage doesn't work. CNMutableContact *contact = [[CNMutableContact alloc] init]; UIImage *logo = [UIImage imageNamed:@"Default"]; NSData *dataRef =…
F.Rao
  • 41
  • 2
4
votes
1 answer

CNContactViewController hide navigationbar after contactImage fullscreenView

I display contact detail page from my application using following code let unkvc = CNContactViewController(forContact: Contact) unkvc.contactStore = CNContactStore() unkvc.delegate = self unkvc.allowsActions =…
Jaydeep Patel
  • 1,699
  • 17
  • 30
4
votes
2 answers

How to force a new CNContact into a Local CNContainer?

I'm writing an app that stores contact-info fetched through REST and JSON into a container, using CNContactStore. I would like to keep these contacts separate from any other accounts, and only stored locally on the device, but a local store doesn't…
pwschulz
  • 41
  • 6
4
votes
0 answers

How to get the creation date of a contact?

Using the new Contacts Framework in iOS 9, how can I get the contacts' creation date? In previous versions, by using the Address Book Framework, I could do this: ABRecordRef person = ... NSDate *creationDate = (__bridge_transfer NSDate…
Marcos Crispino
  • 8,018
  • 5
  • 41
  • 59
4
votes
1 answer

How to fetch iOS Contacts more quickly using Apple's Contacts framework having long list of contacts?

I am using CNContacts to fetch phonebook contacts in my iOS device. When I have a small number of contacts in my phone (say, 50) the contacts are fetched easily. However, when I have a lot of contacts (say 500-700) it hangs/waits for a long time to…
Sam Shaikh
  • 1,596
  • 6
  • 29
  • 53
4
votes
0 answers

iOS: Fetching CNContact Using Identifier?

I'm having trouble refetching a CNContact using an identifier. Early on I enumerate through all contacts and do something with the phone Numbers, while storing the identifiers in an array. Later on I'd like to fetch a specific contact using one of…
KingPolygon
  • 4,753
  • 7
  • 43
  • 72
3
votes
1 answer

Fetch Contact Image - SwiftUI

I'm trying to fetch the image property of a given contact. Here's what I got: Model struct Contact: Identifiable { let contact: CNContact var id: String { contact.identifier } var image: Data? { contact.imageData } var givenName:…
David
  • 333
  • 1
  • 2
  • 14
3
votes
2 answers

Problems implementing Search Controller with CNContacts (Swift)

I'm developing a little app and I want to implement a Search Controller to be able to make queries of the contacts that I have retrieved. I have succeeded in retrieveng the system contacts and display them in a table view. But when I try to…
3
votes
1 answer

CNContact add new contact issue

I'm faccing an issue at time of adding contacts throught Contact Framework. I used device iPhone 5s with iOS 12.1.2 My Code for adding contact is as below :: let saveRequest = CNSaveRequest() saveRequest.add(self, toContainerWithIdentifier: nil) do…
The iOSDev
  • 5,237
  • 7
  • 41
  • 78
3
votes
0 answers

Updating linked/unified contacts with Contacts library fails

Issues with updating linked contact using Contacts library swift. I am trying to update a contact in my contact list in my application. This contact is linked with another contact in the contact list built in on the phone. So when I try to update…
3
votes
2 answers

How to add contacts custom app account like below screen shot

I'm developing an app which needs its own contacts to be visible in their contacts. Like Whatsapp, I need to show the contact nos that they are registered in my app. For example, If you add a Friend's whatsapp no in contacts, it will show Found in…
3
votes
1 answer

SiriKit and CNContactStore

Can you really access the contact database in a Siri extension? I'm trying to make an INSendPaymentIntent extension, in which a user can specify a person he's trying to send money to. This works on a simulator (Xcode 8.3.2, iOS 10.3) just fine, but…
alexk
  • 131
  • 1
  • 6
3
votes
1 answer

Programmatically save a home address to a new contact using CNContactStore? Swift 3

I would like to programmatically create a contact in my app and save it into actual contacts using apples Contacts framework. I can create one with a first name, last name, and even work with dates. I start with let contact =…
user7420999