I've seen already some topics on this subject, but havent been able to find the answer:
Safari cannot open .pkpass files that I am sending as email attachemnts
first I thought it might have something do with my settings, but then I found out that I also cant open example .pkpass from this website
http://www.tomttb.com/test/pass/full_sample/
Both mine file and the example one have Content Type set to
application/vnd.apple.pkpass
On Android I am using PassWallet App, and it is possible to download .pkpass and to add it to the passbook.
Any ideas?
Having looked at your .pkpass bundle, your problem is that your pass.json
file contains invalid JSON.
The device console log shows the following when attempting to add the pass:
Feb 12 00:31:58 pfr MobileSafari[236] <Warning>: Invalid data error reading pass
/var/mobile/Applications/AF19C13B-113D-44B9-9067-1228253C82ED/Library/Caches/com.apple.mobilesafari/com.apple.Passbook/5BE44BA0-7E7F-4DFA-92ED-D5E41A984F82.pkpass/pass.json.
Could not read json from URL file:///var/mobile/Applications/AF19C13B-113D-44B9-9067-1228253C82ED/Library/Caches/com.apple.mobilesafari/com.apple.Passbook/5BE44BA0-7E7F-4DFA-92ED-D5E41A984F82.pkpass/pass.json:
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)"
(Badly formed object around character 221.) UserInfo=0x148cca010 {NSDebugDescription=Badly formed object around character 221.}
Add a comma after:
"foregroundColor": "rgb(255,111,15)"
and change the key:
"description" : '"totally cool party"',
to:
"description" : "\"totally cool party\"",
Then recompile your .pkpass bundle and you should be good.
** Update **
Your pass is now failing because you have set a string for the formatVersion
key when it requires an integer.
Feb 12 11:04:22 pfr MobileSafari[1825] <Warning>: Invalid data error reading pass pass.com.ticketino/2677326. Value for key 'formatVersion' must be of class NSNumber, but is actually of class __NSCFString.
Feb 12 11:04:22 pfr MobileSafari[1825] <Warning>: PassBook Pass download failed: The pass cannot be read because it isn’t valid
Change the key:
"formatVersion": "1",
To:
"formatVersion":1,
Also, it looks like your relevant date is not in an ISO8061 format, which will also cause the pass to be rejected.
To fix, change the relevantDate
key to:
"relevantDate" : "2014-02-28T12:00:00Z",
As to how you diagnose these issues, just connect your phone up to a Mac running Xcode and monitor the device console from the Organizer window. If you need more detailed information, you can enable Additional Passbook Logging from the Developer setting menu on the device.
** Update 2 **
Now your pass is failing because the webServiceURL
is a secure URL. For production passes your Passbook Web Service MUST be served over https
.
If your device is configured for development then you can bypass this by activating the "Allow HTTP Services" option from the Passkit Testing section of the Developer Settings menu.
Also your pass does not contain an authenticationToken
key. This is a mandatory key when specifying a webServiceURL
(Read the Passbook Web Service Manual!)
Debugging Passbook without access to Xcode is going to be extremely tricky, if not impossible. Would recommend either buying a Mac, or resorting to one of the many ways to Virualise Mac OSX or run Mac OSX on PC Hardware.
** Update 3 **
Feb 12 23:21:36 pfr MobileSafari[225] <Warning>: Invalid data error reading pass pass.com.ticketino/2678239. Unable to parse relevantDate 28-05-2014T12:00:00Z as a date. We expect dates in "W3C date time stamp format", either "Complete date plus hours and minutes" or "Complete date plus hours, minutes and seconds". For example, 1980-05-07T10:30-05:00.
Feb 12 23:21:36 pfr MobileSafari[225] <Warning>: PassBook Pass download failed: The pass cannot be read because it isn’t valid.
Your relevantDate
key is still not a valid ISO8601 date!
To fix, change the relevantDate
key to:
"relevantDate" : "2014-05-28T12:00:00Z",