问题
I created a simple demo passbook pass in iOS 6. I emailed it to myself and it works fine. Now I need to share it with people. I uploaded the .pkpass file to the server but safari is not able to recognize the file format or mime type and hence it does not download it.
Any ideas how can I share it?
回答1:
Safari should recognise these.
I think you probably need to add the MIME type to your web server, so it knows how to present the file to visitors.
Edit: the MIME type you need to add to your web server is application/vnd.apple.pkpass
回答2:
Passbook is only availiable on the iPhone 5 or phone users that have upgraded is iOS6. It is also available on the latest OS X Mountain Lion 10.8.2 release.
If the person doesn't have any of these, when they see it in their email, it will just show the .pkpass file as is. If they have Passbook on their device, it will do some graphical markup to it and they can click to add it to Passbook.
The MIME type has to be supported by your email server, but since you received the pass, it appears your server supports it, or doesn't care. In my case, we had issues with Amazon Web Services Simple Email Services as their WebAPI wasn't accepting files of type:
application/vnd.apple.pkpass
Which has been remedied.
https://forums.aws.amazon.com/thread.jspa?messageID=384277
回答3:
To download a passbook file in Safari (mobile and desktop), you have add the correct mimetype to your server. To do so, you can simply create an .htaccess file (or edit the existing one) and append the following line:
AddType application/vnd.apple.pkpass .pkpass
This will do the magic. After this change, if you'll click on a link <a href="...">
that points to a .pkpass file using Safari mobile on your iPhone it will automatically open it with Passbook.
回答4:
I think that the pkpass files will only be recognised by:
- Devices running iOS6 and above (i.e. with the passbook App installed)
- Safari on OSX 10.8.2 (or above)
Edit: Google Chrome Version 23.0.1271.91 and above on iOS6 now also supports direct download of .pkpass files
来源:https://stackoverflow.com/questions/12610296/sharing-passbook-passes-pkpass