user3300758 user3300758 - 5 months ago 38
Objective-C Question

ABAddressBookCreate deprecated

I'm creating an application that will save a contact to the address book, but when I use ABAddressBookCreate to my code, it appear as a warning. I'm coding in iOS 7.

My question is, what is the substitute for ABAddressBookCreate in iOS 7.

Any help will be appreciated. Thanks.

Answer

Use ABAddressBookCreateWithOptions() instead.

ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, NULL);

More info on usage in the documentation here

edit

The AddressBook framework is deprecated in iOS 9 and replaced with the new and improved Contacts framework: https://developer.apple.com/library/ios/documentation/Contacts/Reference/Contacts_Framework/index.html#//apple_ref/doc/uid/TP40015328