Chapter 9. Address Book Frameworks

The iPhone SDK provides two frameworks for managing the address book: a low-level data access framework (AddressBook.framework) and a high-level user interface kit (AddressBookUI.framework). Because your application runs in a sandbox, it's not allowed to directly interface with the address book's underlying SQLite database. In this chapter, you'll learn how to query contact information using C-language function calls and how to use the UI for selecting contacts.

If your application is using the address book, you'll need to learn about the C-based data access functions, whether or not you choose to add an address book user interface. These functions allow you to read and write information about contacts. Since you're dealing with another individual's personal data, it's very important to ensure that your code is accurate and respectful of the user's wishes before changing anything. Unlike the Core Location framework, the user is never prompted to grant permission to your application before using the address book. This could change in future versions of iPhone firmware, due to the privacy risk it poses. Using the address book frameworks to harvest personal information about the user's contacts violates Apple's terms and conditions, and is possibly illegal in many countries.

To use the Address Book or Address Book UI frameworks, you'll need to add them to your Xcode project. Right-click on the Frameworks folder in your project, and then choose Add Framework. Navigate to the AddressBook.framework folder, and then click Add. Repeat this process to add the AddressBookUI.framework folder.

To find the address book frameworks, you may have to navigate manually into either /Developer/Platforms/iPhoneOS.platform or /Developer/Platforms/iPhoneSimulator.platform and locate the Frameworks folder in your SDK.