Photo by CardMapr.nl on Unsplash
Apple Wallet: supported barcode types and workarounds
Why my public library cannot support Apple Wallet but you can!
In this blog post, I'll share consumer and developer-related information about Apple Wallet and why membership/loyalty programs may not offer to add a digital card to Apple Wallet.
I got into this topic because I wondered why my beloved San Jose Public Library does not have an option on its website and I am still forced to walk around with a physical keychain tag.
Apple Wallet
Apple Wallet (formerly known as Passbook) is a digital wallet on iOS and watchOS that allows users to store various Wallet passes. Examples: coupons, boarding passes, student ID cards, government ID cards, car keys, event tickets, public transportation passes, store or credit cards. Apple Wallet integrates well with Apple
Wallet was initially introduced as Passbook with iOS 6 (2012). So it has been around for quite a while. So what might be the most popular reason that membership/loyalty programs do not adopt support of creating and distributing passes?
Barcodes
You probably know that there are 1D and 2D barcodes. If not, here is a short recap:
One-dimensional (or 1D) barcodes systematically represent data by varying the widths and spacings of parallel lines. These include some of the most traditional and well-recognized barcode types, such as the UPC and EAN codes. 1D barcodes are also commonly referred to as linear barcodes. The length of a one-dimensional barcode is directly tied to how much information it holds.
Two-dimensional, (or 2D) barcodes systematically represent data using two-dimensional symbols and shapes. They can represent more data per unit area. Also these codes are designed to keep data intact and scannable—even after being ripped, scratched or damaged. 2D barcodes include newer barcode types, such as the QR Code and PDF417.
There are many types of 1D and 2D barcodes and to name the major ones:
- 1D
- UPC
- EAN
- Code 39 | 93 | 128
- Codabar
- ITF
- GS1 Databar
- MSI Plessey
- 2D
- QR
- Datamatrix
- PDF417
- Aztec
Apple Wallet support for barcodes
Sadly Apple Wallet supports only a limited set of barcode types. Understandably the support is better for more modern, 2D barcodes. Only a single 1D barcode type is supported.
Supported types:
Type | Example | Used In |
Code 128 | Supply-chain: compact, high-density codes used in logistics and transportation industries for ordering and distribution. | |
Aztec | Transportation | |
PDF147 | Logistics and Government | |
QR | Retail, Entertainment and Advertising |
The San Jose Public Library uses Codabar which is not supported by Apple Wallet :( despite that Codabar barcodes are used by logistics and healthcare professionals, including U.S. blood banks, FedEx, photo labs, and libraries.
I don't expect libraries in the US (or around the world) to change their barcode symbology. It is a pity that Apple does not offer broader support for barcodes!
Is there a workaround for non-supported barcode types?
As a consumer, I recommend installing Pass4Wallet on your iPhone. This free app allows you to scan a barcode, create a pass, and adds it to Apple Wallet.
As a developer, I wondered how that was possible. Then I noticed that the barcode was not shown at the bottom of the page.
Normally a pass shows a barcode at the bottom of the page. Here is the layout of a store pass.
So developers cannot rely on PassKit
to automatically generate an unsupported barcode but it appears you can generate a barcode image itself and show it as the strip image!
Again, I don't expect the IT department of my local library to know all these hacks/workarounds.
How to generate a barcode image?
If you need to create a 2D barcode, look at the various 2D barcode descriptors offered by CoreImage
.
Unfortunately, CoreImage
does not help you with generating 1D barcodes.
You must draw your own image and use the Codabar encoding as a reference.
Learning material on how to create an Apple Wallet pass as a developer
I found these resources when researching and testing to create my pass programmatically.
- Getting started documentation from Apple: developer.apple.com/documentation/walletpas..
- Pass Design And Creation: developer.apple.com/library/archive/documen..
The PassKit support materials are available in Apple's Developer downloads area. They contain fully worked example passes, a command-line tool to help you sign passes during development, and a sample implementation of the web service.
I also found PassEncoder, an open-source Swift Package, helpful in creating the pass from source and then signing the pass.