How to Set Mime Type of Application/Vnd.Apple.Pkpass in Order to Share Pass by Link or Email

How to set MIME type of application/vnd.apple.pkpass in order to share pass by link or email

Apache

Add the following line to either:

  • the .htaccess in the directory serving your .pkpass, or
  • to the mime.types file, or
  • to your appache httpd.conf or virtuatl server .conf file

Then restart Apache (not required if adding to .htaccess)

AddType application/vnd.apple.pkpass    pkpass

nginx

Add the following line to your mime.types file and restart nginx

application/vnd.apple.pkpass    pkpass;

IIS

  1. Open IIS Manager and navigate to the level you want to manage.
  2. In Features View, double-click MIME Types.
  3. In the Actions pane, click Add.
  4. In the Add MIME Type .pkpass
  5. Type application.vnd.pkpass n the MIME text box
  6. Click OK
  7. Restart IIS

If you are serving your file via a script and are not able to edit your web server config you could add the following line before any content is sent:

PHP

header('Content-Type: application/vnd.apple.pkpass');

C#

WebClient client = new WebClient();
client.Headers.Add("Content-Type", "application/vnd.apple.pkpass");

How to share pass via email

By using Mail.app, now I can send a pass to others to add to passbook !

Passbook application/vnd.apple.pkpass mime type is not recognized

try to add a filename like this:

return File(generatedPass, "application/vnd.apple.pkpass", "my-file-name.pkpass")

Apple PassKit Wallet download link on website

You need to set the MIME type to application/vnd.apple.pkpass for iOS to recognise the file as a pass and to open Wallet.

See this question for how to do that.

PKPASS not opennig in Passbook

Looking at your pass.json I can see two errors.

"beacons": [{
"proximityUUID": "",
"relevantText": "",
"major": "0",
"minor": "0"
}],
"locations": [{
"longitude": "90.42607140943142",
"latitude": "23.7636902410487",
"relevantText": "office"
}],

The first error is that your beacons dictionary contains an invalid entry. You have not supplied a proximityUUID or relevantText.

The second error is being caught by Xcode.

Jun 10 09:09:02 pfr MobileSafari[4660] <Warning>: Invalid data error reading pass pass.com.retailness.testing.passbook/314548. Value for key 'latitude' must be of class NSNumber, but is actually of class __NSCFString.

You are providing your latitude and longitude values as strings when they need to be provided as decimals.

Drop the beacons array and the quotes around the lat and long values and you should be ok.


Update

Your new pass is fine. It is not loading on the phone because your web server is not applying a Content-Type header and therefore iOS does not recognise this file as a pass.

HTTP/1.1 200 OK
Date: Fri, 12 Jun 2015 17:25:58 GMT
Server: Apache
Last-Modified: Thu, 11 Jun 2015 07:44:56 GMT
Accept-Ranges: bytes
Content-Length: 20604

Add a Content-Type: application/vnd.apple.pkpass header to this file and you should find that it loads ok.

For more info on how to add the header, see the answers to this question.

sending PKPAss to Safari with PHP

Your web server is not correctly set up to serve the file with a MIME type that identifies the .pkpass file as a Passbook pass. More so, your server appears to be using a text or html MIME type that instructs the browser to read the file as text.

See my answer to this question for how to properly configure your server.

How many steps do I have to follow in order to update a pass for passbook

To push an update you need to follow the steps below:

  1. Build a RESTful web service to this specification
  2. Add an webserviceURL and authenticationToken to your pass.json
  3. User installs the pass on their deivce
  4. Your web service, captures the deviceLibraryIdentifier and pushToken
  5. You create the updated .pkpass bundle
  6. Open a connection to the Apple Push Notification Service (APNS) using the Pass Type ID Certificate matching the passTypeIdentifier in your pass.json
  7. Pack and send an APNS message containing the pushToken and an empty payload
  8. Wait for the device to retrieve the push message and request the serialNumber of all updated passes matching the passTypeIdentifier (request may also contain a passesUpdatedSince tag)
  9. Your web service responds to the request from the device with the serialNumber of the updated pass (or passes updated since the passesUpdatedSince tag).
  10. Wait for the device to respond with a request to send the new .pkpass bundle
  11. Your web service sends the updated .pkpass bundle to the device.
  12. The device processes the new pass and if appropriate, displays a notification.

You've already asked several times how to achieve steps 1 through 4 elsewhere on Stack Overflow.

I think you still are struggling to understand the concept that it is not YOU that registers the device - it is the DEVICE that registers itself.

Until you have built a web service that can catch and store the deviceLibraryIdentifier and pushToken, you won't be able to progress any further.



Related Topics



Leave a reply



Submit