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

How to reference external iOS system state updates in SwiftUI?

There are many possible variants of this question, but take as an example the CNAuthorizationStatus returned by CNContactStore.authorizationStatus(for: .contacts), which can be notDetermined, restricted, denied, or authorized. My goal is to always…
Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
5
votes
1 answer

How can I create a CNContact with a CNPostalAddress?

I tried this: let contact = CNMutableContact() contact.namePrefix = data["firstName"] as! String contact.nameSuffix = data["lastName"] as! String contact.organizationName = data["company"] as! String contact.jobTitle =…
Sebastian
  • 6,154
  • 5
  • 33
  • 51
5
votes
1 answer

Contact identifier returns with ABPerson suffix

I am adding contact using Native CNContactViewController and once contact saved it returns contact's identifier with ':ABPerson' suffix and when I cross check in contact list same contact appears with different identifier. Does anyone know how to…
R.S.
  • 51
  • 4
5
votes
0 answers

Programmatically Link one CNContact to another, (swift iOS)

I wants to link one contact to second contact programmatically... I've linked it from phone, but could not find any code for it. var store = CNContactStore() let contact = try store.unifiedContact(withIdentifier: contactIdentifier,…
Salome Tsiramua
  • 763
  • 3
  • 9
  • 21
5
votes
0 answers

Checking if any contact in contact app has been changes (Swift)

Right now I build an app that provide sync contacts. For that, every time the app comeback to foreground, I check all contacts(CNContact) and compare to my contact in app's core data and detect if any contact that different and merge the data. It…
Aldo Lazuardi
  • 1,898
  • 2
  • 19
  • 34
5
votes
0 answers

CNContactstore - Label of a phone number returning null in iOS 9.3.4 and 9.3.5

I have a weird problem and I hope this is Apple's bug. let me know if this is a Apple bug. Steps Open Dialer Dial a number and add to contacts using + sign as number1 Open contacts and add number2 to contacts using contacts app Now the below code…
Arvind
  • 493
  • 1
  • 8
  • 23
5
votes
0 answers

How to share a contact from iOS app to Whatsapp?

Sharing .vcf to WhatsApp using UIActivityViewController fails by showing plugin net.whatsapp.WhatsApp.ShareExtension invalidated error Sharing image or text is working using UIActivityViewController, But sharing .vcf is not working with whatsapp…
Annie Dev
  • 282
  • 1
  • 10
5
votes
2 answers

iOS 9 - fetched Contacts return with empty Phone Numbers

Any ideas why some CNContacts come back with EMPTY Phone Numbers? I keep getting output like this: "phoneNumbers=(not fetched), emailAddresses=(not fetched)," So for example, when I'm fetching Contacts from the Simulator's built-in Contacts App, I…
Sirab33
  • 1,247
  • 3
  • 12
  • 27
5
votes
1 answer

Not able to create vcard of contacts using contact framework

I am using this code to export contact from ios phonebook to .vcf file. I have used this code for the task. But vcardString is always returning nil. Please help me to solve this issue. NSMutableArray *contacts=[NSMutableArray alloc]…
5
votes
1 answer

CNContactPickerViewController with UIToolbar

How do I implement same contact picker as in iOS Apple Maps? As you can see from pictures, in Maps app you can switch between favourites places and your contacts. I want switching between picker and some custom table without dismissal animation and…
jendan
  • 271
  • 4
  • 14
5
votes
2 answers

iOS: get digits key from CNContact

I am using the Contact framework new to iOS 9 and I cannot figure out how to get the digits from the phoneNumbers key on a CNContact. Doing an NSLog of the CNContact I get this output:
MSU_Bulldog
  • 3,501
  • 5
  • 37
  • 73
4
votes
2 answers

Get Street Address From Contact Swift

I create an app, user can select contact an then get name, birthday, and street address. I can get & display name and birthday. But I can't get street address here's my code @IBOutlet weak var names: UILabel! @IBOutlet weak var birthday:…
Ariel Gemilang
  • 796
  • 2
  • 20
  • 42
4
votes
2 answers

How to get RecordID from CNContactStore ios

This is my code to get the device's Contacts and save to MutableArray. But I need to get the recordID for all contacts individually and save into the same Array for further use. (For example, to delete Contacts using recordId). Please help me, I'm…
Inder_iOS
  • 1,636
  • 1
  • 12
  • 20
4
votes
1 answer

Matching CNcontact and Digits Find Friends Swift 3

I am trying to build iPhone App with digits Find a friend feature I can get list of matching digitUserID from Digits. Now I am struggling to match UserID and CNContacts. Please point any examples to deal this. As update: do { try…
Kaviyarasu Arasu
  • 329
  • 5
  • 13
4
votes
1 answer

Using CNContactViewController without adding a contact (swift)

I want to use contactsUI CNContactViewController.init(forNewContact: a) for view only and take the value to the server. However, right now the func also adding a contact to addressbook/contact app, is it possible to prevent this?
Aldo Lazuardi
  • 1,898
  • 2
  • 19
  • 34