IOS 6 After the application access Address book needs to obtain user authorization, and only authorized once, even if uninstalled after installation, do not have to authorize again;
Two frames are required to develop the Address Book application:
The 1.ABAddressBook is used primarily to provide APIs that access records and attributes in the Address Book, using the UI he needs to build himself.
2.ABAddressBookUI This framework gives us 4 view controllers and the corresponding delegation protocols, they have provided the UI interface
The classes in the Abaddressbook framework that precede the class "()" are classes in the foundation, and () within the Core Foundation framework class
Abaddressbook (ABADDRESSBOOKREF) package access to the Address Book interface;
Abperson (ABPERSONREF) encapsulates the address book personal information data, is a database of records;
Abgroup (ABGROUPREF) encapsulates address book information data, a group contains more than one person's information, 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 delegation protocol is abpeoplepickernavigationcontrollerdelegate
Abpersonviewcontroller View and edit the information for a single contact, the corresponding delegation agreement is abpersonviewcontrollerdelegate
Abnewpersonviewcontroller Create new contact information, the corresponding delegation agreement is abnewpersonviewcontrollerdelegate
Abunknowpersonviewcontroller renders a record section of information that can be used to create new contact information, or to add to an existing contact, the corresponding delegation agreement is abunknowpwesonviewcontrollerdelegate
We use the Core Foundation framework when using Abaddressbook, and the Core Foundation (c) Framework and Foundation (O-C) framework are the same functional interfaces, if you want to mix and match "no overhead bridging between two frames" ”;
Here's an example with Nsaarray:
To convert a core foundation type to a foundation type
Cfarrayref x; The first mode of conversion nsarray *array = (__bridge Nsarray *) x; The second mode of conversion is array = cfbridgingrelease (x);
When you use the first conversion method, you do not convert the object ownership, just the cast. Manual release of objects is required;
Convert object ownership when using the second conversion mode, and transfer all rights of object to Arc, no manual release required
Convert the foundation type to the core foundation type
Nsarray * array = nil; The first way cfarrayref arrayref = (__bridge cfarrayref) array; The second way arrayref = Cfbridgingretain (array);
Both of these methods are also the first to not convert the object ownership, or the foundation object so it is automatically released.
The second Transfer object ownership requires a manual release of the object (Cfrelease (arrayref);)
IOS Contacts Basics