0

I am trying to add ABAdressbook support to my IOS5 app. Been looking the documentation. I get this code where we create a ABAdressbook instance using:

ABAddressBook *addressBook;
ABPerson *newPerson;
addressBook = [ABAddressBook sharedAddressBook];

(This is from the apple documentation.)

I added the headers and the framework accordingly. But the compiler (xcode) does not recognise ABAdressbook. This left me to wonder if this code is only good on the OSX API and not valid under IOS?

So far the working code I get always goes by creating an ABAddressBookRef using :

ABAddressBookRef addressBook = ABAddressBookCreate();

I have not found much good documentation for IOS Addressbook programming and the apple documentation is quite obscure when it come to working with groups.

So I am looking for a bit of help and a few good pointers.

Pascale Beaulac
  • 889
  • 10
  • 28
  • Have you read the [Address Book Programming Guide for iOS](https://developer.apple.com/library/ios/#documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Introduction.html#//apple_ref/doc/uid/TP40007744)? It covers all of this. The whole address book API is in C, not Objective-C which is why your first bit of code isn't working. – rmaddy Nov 15 '12 at 00:52
  • I did read an "Address Book Programming Guide" but from what I seen in the one you have provided the one I read must have been for MAC OS and not IOS. thanks this does confirm that the documentation I have been hitting on google was for Mac OS. – Pascale Beaulac Nov 15 '12 at 03:49
  • I have no idea what documentation you found via Google. The docs I linked to are for the iOS docs and match the 2nd bit of code you posted. That is the proper API for an iOS app. Instead of Google, go straight to [Apple's iOS docs](https://developer.apple.com/library/ios/navigation/index.html) or look at the docs right in Xcode (via the Organizer window). – rmaddy Nov 15 '12 at 03:53

1 Answers1

1

Create the ABAddressBook like this ABAddressBookCreate() no longer exists.

ABAddressBookRef addressBook =ABAddressBookCreateWithOptions(NULL,NULL);
Raon
  • 1,266
  • 3
  • 12
  • 25