Reputation: 3610
I have tried the passbook tutorial: http://www.raywenderlich.com/20734/beginning-passbook-part-1 which was recommended in some other SO thread a while ago.
Everything went smoothly, except:
I put the .pkpass file on a local web server, I tried clicking a direct link to the file, hoping it would open on my iOS sim/device, but all I got is "safari was unable to download the file". This also happened with the official iOS pass samples on the Passbook Programming Guide. While on the simulator, no errors come up on the console log.
I tried putting the pkpass in an email, open it from a real device, it comes up ok, but when I click "add", the coupon is not added to passbook. No errors come up either.
I tried creating a pass with passsource.com. If I use their "on the fly" method, I get a good coupon, and I am able to save it. If I choose "download pkpass file" and then use it as described above in #1/#2 - same errors.
The coupon is signed correctly, using correct team id and type id.
My JSON is (I garbled the team/type ids):
{
"formatVersion" : 1,
"passTypeIdentifier" : "pass.com.xxx.xx.xxx",
"serialNumber" : "123",
"teamIdentifier" : "XXXXXXXX",
"organizationName" : "my brand",
"description" : "my coupon",
"logoText" : "logo text",
"foregroundColor" : "rgb(255, 255, 255)",
"backgroundColor" : "rgb(135, 129, 189)",
"labelColor" : "rgb(45, 54, 129)",
"barcode" : {
"message" : "650438-5103453453",
"format" : "PKBarcodeFormatPDF417",
"messageEncoding" : "iso-8859-1"
},
"coupon" : {
"primaryFields" : [
{
"key" : "offer",
"label" : "for you",
"value" : "Free hug"
}
]
}
}
I tested the json with the online validation tool, it's valid.
any ideas why the coupon is not saved/downloaded?
tnx
Upvotes: 1
Views: 1117
Reputation: 3610
I just found the cause of the issue. Seem that the Simulator supports drag-drop of a pkpass from Finder on the Sim. If I do that, I DO see a detailed error message in the system log (I am using the Console app), so I found the problem: 1. My json was changed after I created its sig in manifest.json, so I updated the sig 2. If I want the pkpass file to be served as a pass from a web server, it's not enough to provide a direct link to it, I also need to change the content type to application/vnd.apple.pkpass
After I handled both of these issues, I was able to serve the pkpass file from my web server.
Upvotes: 3