Get to the point of getting the system Address book, do not want to talk more, leave the link http://my.oschina.net/joanfen/blog/140146
Usual procedure:
First create an object addressbooks for the Abaddressbookref class, and then get the system permissions,
Code to get permission:
// get system permissions and get the Address book contents into Addressbooks. abaddressbookref addressbooks = nil; Addressbooks = Abaddressbookcreatewithoptions (null, NULL); dispatch_semaphore_t Sema = dispatch_semaphore_create (0 ); Abaddressbookrequestaccesswithcompletion (Addressbooks, ^ (bool Granted, cferrorref error) {dispatch_semaphore_signal (SEMA); }); Dispatch_semaphore_wait (Sema, dispatch_time_forever); Dispatch_release (SEMA); // get everyone in the Address book Cfarrayref Allpeople = Abaddressbookcopyarrayofallpeople (addressbooks);
It then creates an object Allperson of the Cfarrayref class, accepting adressbooks through Abaddressbookcopyarrayofallpeople (addressbooks).
Then create a Abrecordref class object person, but in fact he is not really a class that contains address book information, this abrecordref is just a record.
The next step is to create the person object by using the method:
Ab_extern cftyperef abrecordcopyvalue (abrecordref record, Abpropertyid property);
To get what information, the property writes Abpropertyid this type of variable, in fact Abpropertyid is a int32_t type variable.
IOS Get system Contacts