Apple's Passbook ecosystem launched with iOS 6 in 2012 to great success, and it has been updated and refined in iOS 7. Most of the changes are additions to the pass JSON structure that can safely be sent (and ignored) to iOS 6 devices and properly interpreted by iOS 7 devices. Apple has also tweaked the PKPassLibrary APIs to add new features to make development easier and updated its pass display guidelines to fit with iOS 7's new visual design.

Richer Pass Content

If you got away without the recommended image dimensions for your images such as creating your own gloss or sizing the image to fit within boundaries of the strip on an iOS 6 device you won't be able to get away with it on a iOS 7 device because of the increase in image size. The no shine change is interesting because I have personally noticed (through the CardStar App) on iOS 6 devices that shine and even the glass screen of the phone itself can wreck havoc on barcode scanners. The next few bullet points explain changes in the look of the pass.

  • iOS 7 passes are now shown with the full width of the display. Strip images are now 320 points wide (up from 312 points), which means that images from an iOS 6-styled pass will be stretched on an iOS 7 device.

  • Logos are no longer displayed with an etched effect, in iOS 7 they are masked with a solid color. Remember you will still need to provide non-retina images for pre-iOS 7 devices.

  • Less gradient, no shine, wider strip images.

Grouping

Passes are now grouped automatically in the Passbook app. Developers can control grouping with by setting the same groupingIdentifier for all of the passes in a group:

"groupingIdentifier":"jappleseed",

Grouping works well with event tickets or boarding passes where it is common to have multiple passes for a single logical activity.

Time Zone

Passes on iOS 7 can override the device's automatic date formatting that adjusts any date to your current time zone so you can show a start time in the time zone where it will take place. For example you typically would want to show the check-in time for a hotel in the hotel's time zone regardless of where the device currently is.

{ "key":"checkIn", "value":"2013-08-19T15:00-08:00", "timeStyle":"PKTimeStyleShort", "ignoresTimeZone":true }

Note that the time format hasn't changed, so you still need to provide local time zone. A lot of the new features to Passbook added by Apple came from consumer feedback and this is one of them.

App Integration

Passes on iOS 7 have more opportunities for integration with apps. You can now provide the link used to switch to the app linked to the pass, which allows you to adjust your user interface for the user's action. The most obvious case would be to include the pass serial number and then present an interface customized to that pass. For example, a retail application could present a list of recent purchases made under a specific loyalty card number.

"appLaunchURL":"myapp://pass/1A629"

Metadata

Passes can now provide an arbitrary info dictionary for metadata (no word from Apple on size limitations of this). This grants some flexibility to store important information that is accessed frequently (read: no round trips to a server) or as a simple fall back in case the device doesn't have an available Internet connection.

"userInfo":{"aKey":"aValue","hint":6}

Note that this data will appear in a JSON text file, so you don't want to store any sensitive information here.

iOS 6 passes used the standard set of UIKit data detectors on text within a pass, however this approach could sometimes incorrectly detect text as meaningful data. For example, if it happened to include a 10-digit ID number, it would be linked as a phone number regardless of its actual meaning as a plain number. To fix this, Apple now allows passes to specify what kind of data can be detected.

"dataDetectorTypes":[...] (array of strings)phone number, address, email, URL. Default is all.

Example of string value would be ["UIDataDetectorTypePhoneNumber", ...] The current data detectors provided by Apple are: UIDataDetectorTypePhoneNumber, UIDataDetectorTypeLink, UIDataDetectorTypeAddress, UIDataDetectorTypeCalendarEvent, UIDataDetectorTypeNone, and UIDataDetectorTypeAll. This change is great because it puts the pass configuration and display back in control of the developer, who will almost always know the best way to present pass data.

Pass fields commonly include URLs to terms and conditions, additional restrictions, or home page of the pass creator. These are often too long or ugly to read, but are required to be included in their entirety to ensure they are detected by the link data detector. New in iOS 7 is the ability to format URLs with the attributedValue field. It supports a subset of HTML for fields on the back of a pass.

{ "key":"about", "value":"More information at http://apple.com/", "attributedValue":"<a href="http://apple.com">More Information</a>" }

Note: You still need keep iOS 6's value field for backwards compatibility.

Needless to say anyone who has worked in a pass configuration file is happy with this update in iOS 7. There was no telling when adding a URL to the back of the pass if it would be picked up and how it would look. It's much better to have the atypical "click here" text than some long URL that spans a couple of pass lines.

Adding Multiple Passes at Same Time

You can now add multiple passes at the same time in iOS 7. When a user selects multiple passes to add a pass, Passbook will present with two options: "Add All" or "Review". This new user interface is presented in response to a new PKPassLibrary API addPasses:withCompletionHandler:. If the user chooses "Review", the completion handler will be given a status of PKPassLibraryShouldReviewPasses and you should present a PKAddPassesViewController with the array of passes.

Adding multiple passes is an all or nothing selection. If the user sees a single pass of in the set he doesn't want to add, he is forced to cancel the entire set, therefore Apple recommends you provide your own UI for choosing passes if needed.

Sharing Passes

It has always been possible for a pass to exist on multiple devices, but with iOS 7 Apple has made it easier. You can now share passes via a "Share" button in the corner of pass. Tapping this button will let you share your pass with other users via AirDrop, Message or Mail. Since passes are now easier to get from one device to another, it is essential to make sure you have strong validation on your passes. I can also see this feature reducing server load on the server that supplies passes. If your server ties to other back-end systems to create the pass it should reduce overall system load. A good example of where this could be effective is loyalty cards shared between significant others and/or family members.

Code Scanning - via 'Scan Code' Button in Passbook

Code scanning is a low-friction way of getting a pass. Users can now scan 2D code images from the Passbook app to retrieve a pass you can add parameters to the URL and generate a pass based on those parameters. For example you can include parameters to customize a pass; a users information, even the pass type you want to generate (even a simple parameter to identify how users are getting your pass). There are a couple conditions: the URL does have to return a pass so scanning a 2D code that simply leads to a website or only gleams customer information is not permitted and the URL must be HTTPS (so again the code can't point to just a simple website) and the pass service must support standard Passbook barcode formats.

Passes on Lock Screen

Apple has tweaked the relevance algorithm for passes on the lock screen so that they appear when you need them. This puts the passes one swipe away and increases the convenience of a pass.

Relevance

Apple wants to make clear that relevance is how you access a pass; whereas notification happens when new pass information is available. In iOS 6 relevance is coordinate-based. Passes have 10 places that a device would recognize within a certain fixed distance and any changes to those coordinates would require a pass update. Apple has improved location-based relevance in iOS 7 with proximity triggers based on iBeacons, which are a low-energy Bluetooth signal that only rely on proximity and not location. A good example would be a taco truck that doesn't have a fixed location but does have a certain radius around it where the pass would be relevant. Beacons are also useful in a small space, like a shopping mall, where GPS accuracy may not be sufficient to locate you. JSON field example:

"beacons":[{ "proximityUUID":"99C759FE-C660-4B95-981A-0C53E0EE6124", "relevantText":"Delicious food nearby" }]

Here "beacons" is a pass top-level key that contains an array of to 10 beacon identifiers that will signal this pass's relevance. Other iOS devices can act as beacons themselves, which is perfect for a point of sale application to trigger a customer's pass. Distance can be constrained to a particular area in iOS 7 to prevent passes becoming relevant too soon using:

"locations":[{ "latitude":37.783062, "longitude":-122.404084, "maxDistance":500 }]

This is good in situations such as bus stations that use boarding-style passes. You don't want the pass becoming relevant a mile away.

Expiration

You can now mark a pass as expired:

"expirationDate":"2013-08-19T9:41-08:00"

or

"voided":true

Typically a vendor's backend systems would prevent the use of an expired pass, however giving the user a visual indication avoids confusion or embarrassment when he or she tries to use the pass.

Tips and Tricks

In Settings > Developer > PassKit Testing there are three PassKit testing switches: additional logging, allow HTTP services and disable rate limiting. "Additional logging" throws more messages to the log passbook service so you can more easily see how the code is being exercised (validation errors and service problems are the most important). "Allow HTTP services" allows you to use a non-secure http service while testing your application and web services. In production all Passbook-related URLs must use HTTPS. "Disable of rate limiting" allows you to hit the passbook services as often as you like for testing purposes. Normally rate limiting it used to preserve battery life on the phone and ease network load if Apple sees a lot of pass update requests from the same device.

Conclusion

iOS 7's Passbook changes don't include grand new features for end-users, however it follows Apple's strategy of consistent, iterative improvement and polishing of the interface. Users might not immediately realize that pass URLs or relevance calculations have been improved, but the overall experience of using a pass is better overall. Passbook participation depends on vendor support and customer adoption, and iOS 7's changes enhance its use for both parties.