Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
982 views
in Technique[技术] by (71.8m points)

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

I just created an app and a pass, so I can add the pass to the PassBook in iPod, but I cannot share the pass by email or link from web server. From the documentation I read from Apple, I need to add a MIME type as application/vnd.apple.pkpass. However, I don't understand clearly what steps should I do. I don't know how to use MIME type.

How should I add this MIME type in order to use pass from my web service?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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");

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...