cncontact

how to retrive all CNContactStore from device without filter

◇◆丶佛笑我妖孽 提交于 2019-11-30 13:52:26
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) { AppDelegate.sharedDelegate().checkAccessStatus({ (accessGranted) -> Void in if accessGranted { dispatch_async(dispatch_get_main_queue(), { () -> Void in do { let predicate: NSPredicate = CNContact.predicateForContactsMatchingName(name) let keysToFetch = [CNContactGivenNameKey, CNContactFamilyNameKey, CNContactBirthdayKey, CNContactViewController

CNContactStoreDidChangeNotification is fired multiple times

為{幸葍}努か 提交于 2019-11-30 07:57:51
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 posts MULTIPLE times (2, 3, 5, and even more times) even if I only add one new contact. Where is the problem? Make certain you aren't adding the observer multiple times. This can happen without you realizing it if (for example) you call -addObserver from -viewDidLoad or -viewDidAppear in your view controller (as these might get called more than once

iOS Swift CNContactPickerViewController search contact and add to selection

眉间皱痕 提交于 2019-11-29 11:31:57
问题 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 name, I need to add that name to my selection but nothing happens after tapping the contact. I searched everywhere and dint find any solution to this Do I need to add anything to my code or is it a iOS 9 bug @IBAction func AddBtnKlkFnc(sender:

Keyboard overlaying action sheet in iOS 13.1 on CNContactViewController

本秂侑毒 提交于 2019-11-28 00:35:20
问题 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 not dismissing. 回答1: Kudos to @GxocT for the the great workaround! Helped my users immensely. But I wanted to share my code based on @GxocT solution hoping it will help others in this scenario. I needed my CNContactViewControllerDelegate

CNContactViewController forUnknownContact unusable, destroys interface

偶尔善良 提交于 2019-11-27 03:34:53
[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 button (Unknown Person). Grant access if requested. You are shown the partial contact, in our navigation