Reputation: 2471
How do I use CNContactPickerViewController() in xcode7 swift , should I import ContactsUI framework ,Im not sure , Basically I want to show the ContactPickerViewController when a button is pressed .
Note : If you guys know know the equivalent of the above in AddressBookUI Framework in swift or objective-c Please be helpful in sharing it I will modify it to make that work in ContactsUI Framework and i will post that so that it will useful for others in future
Upvotes: 1
Views: 3122
Reputation: 93
Follow these steps:
import ContactsUI
In your code initialize :
let contactPicker = CNContactPickerViewController()
contactPicker.displayedPropertyKeys =
[CNContactEmailAddressesKey, CNContactPhoneNumbersKey]
self.presentViewController(contactPicker, animated: true, completion: nil)
The code should be presented and not pushed into navigation controller else you will see a black screen on the view with a delayed animation.
Upvotes: 8