Tag Archives: address book

The development of Contacts2Web

Introduction

contacts2web_512Part of the online course that I took from Stanford on iPhone app development involved choosing a final project. My top-level criteria for choosing a project included:

  • Incorporate several different iOS technologies.
  • Make use of an external web service and API.
  • Interaction with an external web site.

What I eventually settled on was a concept for allowing a user to view and edit their iPhone Address Book contacts both within an app as well as in a full web browser.

This functionality is already available as a service now at iCloud.com. My plan was to start with this capability and over time begin to add new functionality (social sharing, etc).

The Contacts2Web app is now available in the App Store.  In this document, I will cover some of the details that went into developing the app.

Continue reading

Advertisements

Using and customizing the Address Book UI framework

Apple provides a nice framework for incorporating Address Book access  into your iOS application, using  the familiar UI from the Contacts app.  They provide some nice documentation on this UI in the section User Interaction: Prompting for and Displaying Data.

Here is an example of the UI that Apple indicates is available:

AddressBookUIFramework

The default UI is a little different

The above view of the controllers looks great, but getting them to work together as the images imply is not quite so straightforward.  Consider the following code snippet used to present the People Picker:

Continue reading

Using @autoreleasepool to reduce your memory footprint

When I was reviewing iOS memory management in the Apple documentation, I came across the section Use Local Autorelease Pool Blocks to Reduce Peak Memory Footprint

With the introduction of ARC (Automatic Reference Counting) memory management is largely taken care of for you.   There are still some cases you need to worry about though, including an increase in your memory footprint caused by creating temporary objects in a loop.

Consider the following code that allows me to populate some test data into the iOS Address Book.   Note that I inserted a sleep(4) after each iteration to more clearly show the memory allocation picture in steady state before a new iteration begins.

Continue reading

Debugging memory leaks with Instruments and Heapshots

I was first introduced to Instruments in the CS193P course that I took over the past few months.   I found them to be invaluable for debugging memory leaks as I work on my Address Book iPhone app.

iOS Memory Instruments

Continue reading

Memory management with iOS

In creating my first iPhone app which uses the Address Book, I discovered the world of memory management with iOS.  I wanted to share a few things I’ve learned and provide lots of links for your reference.

ARC, retain counts and CFRelease

Admittedly, if you stick strictly to Foundation code, you probably don’t need to be concerned too much about what happens under the hood.   With the introduction of ARC (Automatic Reference Counting), iOS takes care of much of this for you.  It’s when you also need to deal with Core Foundation (CF), which the Address Book uses, that things become tricky.   CF has a concept of object ownership and memory management using retain counts.   An object can have multiple owners (retain count > 1), but when you are done with that object the retain count had better be zero or you’ll create memory leaks.    To accomplish this, you need to use CFRelease().

Continue reading