IOS Contacts Basics

Source: Internet
Author: User

After IOS 6, the app access address book needs to be authorized by the user, and is only authorized once, even if it is uninstalled and then installed. There is no need to authorize again.

There are two frameworks needed to develop your address Book application:

The 1.ABAddressBook is primarily used to provide access to APIs such as records and attributes in the Address Book, using which he needs to build the UI himself.

2.ABAddressBookUI This framework provides us with 4 view controllers and corresponding trust protocols, they have provided the UI interface


The class that precedes the Class "()" that is often used in the Abaddressbook framework is the class in the foundation. () within the Core Foundation framework class

Abaddressbook (ABADDRESSBOOKREF) package access to the Address Book interface;

Abperson (ABPERSONREF) encapsulates the address book personal information data, which is a record of the database.

Abgroup (ABGROUPREF) encapsulates the address book information data, a group includes the information of multiple people, a person's information can belong to more than one group;

Abrecord (Abrecordref) encapsulates a record in the database, the records are composed of attributes;


View controllers in the Abaddressbookui framework

Abpeoplepickernavigationcontroller He selects the contact navigation controller from the database, and the corresponding trust agreement is abpeoplepickernavigationcontrollerdelegate

Abpersonviewcontroller View and edit the information for a single contact, the corresponding trust agreement is abpersonviewcontrollerdelegate

Abnewpersonviewcontroller Create new contact information. The corresponding trust agreement is abnewpersonviewcontrollerdelegate

Abunknowpersonviewcontroller renders the record part of the information. This information can create new contact information, or join the existing contact, the corresponding trust agreement is abunknowpwesonviewcontrollerdelegate




We use the Core Foundation framework when using Abaddressbook, and the Core Foundation (c) Framework and Foundation (O-C) framework is the same functional interface, assuming that there is a "no overhead bridging" between the two frames required to mix the use ”;

Here is a sample example of Nsaarray:

To convert a core foundation type to a foundation type

Cfarrayref x;    The first mode of conversion    nsarray *array = (__bridge Nsarray *) x;    Another way to convert    array = cfbridgingrelease (x);

When you use the first conversion method, you do not convert the object all right, just the cast. Manual release of objects is required;

Use a different conversion mode when you convert the object all right, and the entire right to transfer the object arc, do not need to manually release

Convert the foundation type to the core foundation type

Nsarray * array = nil;    The first way    cfarrayref arrayref = (__bridge cfarrayref) array;    Another way    arrayref = Cfbridgingretain (array);

These two methods are the same as the first to not convert the entire right of the object. or the foundation object, so I voluntarily release.

Another kind of conversion object All right need to release the object manually (Cfrelease (arrayref);)




IOS Contacts Basics

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.