IOS Get system Contacts

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.