I am working on an existing objective c project , While reading Address Book UI Framework Reference for iOS i found the below classes have deprecated in iOS 9 .
( ABUnknownPersonViewController , ABPersonViewController , ABPeoplePickerNavigationController, ABNewPersonViewController )
What is the replacement of this .? Where i can find some document related this . any help appreciated . Thanks in advance .
Address Book UI Framework deprecated methods
6.1k Views Asked by Sat At
2
The
AddressBookUIframework has been deprecated iniOS 9, so better you should useContactsUIFramework.It has many new features including all the features of
AddressBookUIframework.So, in case if you are targeting the
iOS 9specifically then you should go forContactsUIFramework.To check that
AddressBookUIframework is available for specificiOSversion you can do the following:Here is the complete code for that:
Just make sure that you ask the permission to read the contacts from device.
Reference link: https://gist.github.com/willthink/024f1394474e70904728
For replacement for
AddressBookUIyou need to useCNContactPickerViewController. You can check the delegate methods which can be used to pickup the one or multiple contacts at a time.This will present a inbuilt
UIViewControllerwith all the contacts and you need to implement the delegate methods of it!CNContactPickerDelegatereference: https://developer.apple.com/library/ios/documentation/ContactsUI/Reference/CNContactPickerDelegate_Protocol/