cncontact

CNContactViewController forUnknownContact unusable, destroys interface

喜欢而已 提交于 2019-12-17 07:14:17
问题 [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 interface so that your app becomes useless; the user is stuck. To make this bug easy to see, I've posted an example project at https://github.com/mattneub/CNContactViewControllerBug. To experiment, run the project and do the following steps: Tap the

Programmatically delete custom phone labels

给你一囗甜甜゛ 提交于 2019-12-14 02:36:04
问题 In iOS it is possible to create custom labels for phone numbers and email addresses. Is there a way to remove those created labels programatically (either with CNContacts or ABAddressBook)? In other words: I don't want to delete the custom label from a contact, I want to delete the "custom label" from the system so it doesn't show up at all when someone brings up the available available list. Attached iOS 9 source code that creates a contact in the phone book with custom labels on the email

Contact image doesn't send when contact saved by CNContact

南楼画角 提交于 2019-12-13 14:27:25
问题 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 SMS or Email using iOS's default Contact app, the image doesn't add up in vCard. Can anybody guide to me to what I've done wrong? The following is the method that I used to save contact. It is in Swift. func addContact(withData: ContactModel,

Dictionary has optional key

那年仲夏 提交于 2019-12-13 07:15:17
问题 I'm having a array of CNContact and I sort them with this function: for contact in self.contacts { var contactName = contact.organizationName let key: String = String(contactName.characters.first).uppercaseString if let arrayForLetter = self.contactDictionary[key] { self.contactDictionary[key]!.append(contact) self.contactDictionary.updateValue(arrayForLetter, forKey: key) } else { self.contactDictionary.updateValue([contact], forKey: key) } } self.keys = self.contactDictionary.keys.sort()

select multiple properties from single contact in CNContactPicker

浪子不回头ぞ 提交于 2019-12-13 05:30:41
问题 I am trying to use the CNContactPickerViewController and keep running into issues with how to pick multiple properties from a single contact Basic display of the picker let contactStore = CNContactStore() override func viewDidLoad() { super.viewDidLoad() self.askForContactAccess() self.displayContacts() } func displayContacts(){ let contactPicker = CNContactPickerViewController() contactPicker.delegate = self self.present(contactPicker, animated: true, completion: nil) } this displays the

Is it posible to retrieve my own contact details from phone book?

你离开我真会死。 提交于 2019-12-12 19:01:32
问题 I am using the CNContact framework to get all of the contacts from my phone and I need to compare some data with my own contact details. Is it posible to get my own contact details ? I can find myself listed when retrieving the contacts using apple framework, but I don't know how to identify me . Any ideas ? 回答1: There is no way to ask the SDK for the contact of the phone's owner. If you have some information about the owner (like name), then your best bet is to query for contacts with a

How to get country Dial code from CNContactProperty in iOS

别说谁变了你拦得住时间么 提交于 2019-12-11 17:46:58
问题 In CNContactPickerDelegate I can get CNContactProperty . From CNContactProperty How to get Country Code like +91, +1, +65 from the country name like IN, US, SG func contactPicker(_ picker: CNContactPickerViewController, didSelect contactProperty: CNContactProperty) { let FulMobNumVar = contactProperty.contact.phoneNumbers.first?.value let countryCode = FulMobNumVar?.value(forKey: "countryCode") as? String print("countryCode : \(countryCode!)") } Output : countryCode : in 回答1: Based on your

How to filter contacts using a set of phone numbers with CNContactPickerViewController?

寵の児 提交于 2019-12-11 00:26:23
问题 I try to filter some contacts from address book with a set of existing phone numbers. CNContactPickerViewController should disable selection of these contacts when they have matching phone number from existing phone numbers. I need to use phone number as a filter because these phone number can be from other app platforms. And the service should not allow user to use contact with same phone number that is already existed. I don't want to create my own contact picker for just this quick action.

how to fetch contact image and phone Number in my app using Objective C

岁酱吖の 提交于 2019-12-10 21:27:26
问题 I am getting the contact name from my phone. Check my code: - (void) fetchContacts { CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts]; if (status == CNAuthorizationStatusDenied || status == CNAuthorizationStatusDenied) { UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"This app previously was refused permissions to contacts; Please go to settings and grant permission to this app so it can use contacts"

“Create New Contact” and “Add to Existing Contact” for CNContactViewController()

依然范特西╮ 提交于 2019-12-10 13:03:53
问题 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 replicate this functionality in the CNContacts framework. It seemed to me that CNContactViewController(forUnknownContact: contact) could work, but unfortunately this only lets the user "Send Message" or "Share Contact." How can I allow a user to