Chapter 18. Working with the Address Book Database

In this chapter, we discuss the foundation of the Address Book API and several UI elements that can be used to modify the contacts database.

In Section 18.1, we provide a brief introduction to the subject. Next, Section 18.2 discusses property types. After that, Sections 18.3 and 18.4 show how to access single- and multi-value properties, respectively. Next, Sections 18.5 and 18.6 go into the details of the person record and the address book, respectively. Issues related to multithreading and identifiers are addressed in Section 18.7.

After covering the foundation of the address book API, we provide several sample applications. Section 18.8 shows how to use a query to retrieve the photo of a given record. Next, Section 18.9 shows how to use the ABUnknownPersonViewController class. After that, Section 18.10 covers the ABPeoplePickerNavigationController class. The ABPersonViewController class is covered in Section 18.11. Section 18.12 covers the ABNewPersonViewController class. Finally, we summarize the chapter in Section 18.13.

Introduction

The iPhone SDK supports full access to the user's address book. The address book API provides a simple interface to query the address book, create new records, modify records, and delete records. To use this API, you need to add the following import statement:

#import <AddressBook/AddressBook.h>

You also need to add the AddressBook framework to your project as explained in Section D.4.

The address book ...

Get iPhone SDK 3 Programming: Advanced Mobile Development for Apple iPhone and iPod touch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.