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:
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:
I discovered a great debugging tool today from the article Flags: very useful when debugging with Instruments The article talks about how to put up flags from your code that appear in the Instruments window. This is a feature that is new to Instruments 4.0 and is described in the Apple docs at New Features in Instruments 4.0 Let’s jump to the end and show you an example of what you can put up in your Instruments display:
Note the yellow flags above the trace. These were generated in my code within a loop. If you click on a flag you can see the text that I generated for the flag “Loop index 38” along with the source file, line number of the code generating the flag and the method being executed.
I’m using Core Data in an application that I am developing that uses the Address Book. I created some test data and started writing some code that imported this information into Core Data. Curious about the memory usage of this import, I used the Allocations Instrument for analysis and thus began a long process where I believe I may have uncovered several bugs related to Core Data memory management.
What prompted the analysis?
I have seen references indicating that your app risks being shut down for memory usage when you use more than 20 MB of RAM. A couple interesting articles include:
Further on in the Apple document “Cocoa Fundamentals Guide” I also came across a nice class hierarchy chart for UIKit classes. It is located in the section of the document called “What Is Cocoa?“.
I was reading the Apple document “Cocoa Fundamentals Guide” and ran across some nice class hierarchy charts for Foundation classes that I thought I’d share. They are located in the section of the document called “What Is Cocoa?“.
These diagrams logically group the classes of the Foundation framework in categories. Classes in blue-shaded areas are present in both the OS X and iOS versions of Foundation; classes in gray-shaded areas are present only in the OS X version.