Creating and Using Address Book Action Plug-ins

A unique aspect of the Address Book application is its ability to act on data contained within a person's card. You can install your own custom plug-ins to add additional actions to a given record. An example of an existing action is the Large Type action, which works on any phone number entry. When selected from its contextual menu, it displays the number in large type across the screen.

Each action plug-in can implement only one action. Actions can only apply to items with labels. An action can display a simple window in the Address Book application. If your action actions needs to do anything else, it should launch your own application to perform the action.

The ABActionDelegate protocol, which must be followed for the Address Book application to recognize the plug-in, is summarized in Table 1. See ABActionDelegate Protocol Reference for full details. C-based actions must implement a function named ABActionRegisterCallbacks, as described in Address Book Actions Reference.

Table 1  Action methods for an Address Book action plug-in




Returns the NSString constant identifying the property that the action applies to.


Returns the title of the menu item for the action. This method should not return nil.


Performs the appropriate action for the plug-in. Each plug-in can only have one action.


Returns YES if the action is applicable and NO otherwise. This allows your plug-in to enable and disable its menu item. (Optional.)

To create a plug-in, use the Address Book action plug-in template from the Xcode New Project window. The template creates an action plug-in designed to create a contextual menu item on any phone number. When the menu item is selected, the sample plug-in uses OS X’s speech synthesis framework to speak the phone number. Replace this sample code with the code you need for your new plug-in. After you build your project, place the completed bundle in .../Library/Address Book Plug-Ins.

After an action plug-in has been loaded, its menu item is displayed in the contextual menu with the title returned from the titleForPerson:identifier: method; this method should not return nil. The plug-in can enable and disable this menu item using the shouldEnableActionForPerson:identifier: method.