You want to be able to interact with the installed passes on a user’s device programmatically.
Include the PassKit.framework into your project and use the
PKPassLibrary to find the passes that
you are interested in. Passes will be of type
PKPass, so using this class you can retrieve
information about your passes.
As a prerequisite to this recipe, please make sure that you have read Recipe 20.8 and now have an Xcode iOS project that has the appropriate provisioning profile to access your passes in the user’s Passbook library.
Apple has provided the PassKit.framework for iOS developers. Using this framework, you can interact with passes that the user has installed on her devices. To be able to use this framework, you have to first add it to our project. Follow these steps:
On the lefthand side in the Navigator pane, select your project (with the blue icon).
Choose the target that you are building next to the Navigator pane.
On the top of the screen, choose the Build Phases tab.
Move over to and expand the Link Binary With Libraries section and press the + button for it.
In the list of frameworks and libraries that appear on your list, find and choose PassKit.framework and add it to your project, as shown in Figure 20-30.
Figure 20-30. Adding the PassKit.framework to our target in Xcode
Now that you have this framework, ...