简体   繁体   中英

The correct content-type is set, but i the .ipa File is treated like a .zip File

i have written a small Rails Application where i can upload three Files which i needed to distribute the adhoc builds over-the-air. This includes a .ipa File, a .mobileprovisioning File and a .plist File.

The Problem is now, when i click on the link to the .ipa File the File is treated as a normal Download and my iDevices asks me where to store the file.

curl -I example.com/path/to/App.ipa

generates this output

HTTP/1.1 200 OK
Date: Thu, 25 Oct 2012 13:55:08 GMT
Cache-Control: public, max-age=0
Last-Modified: Thu, 25 Oct 2012 10:23:07 GMT
ETag: "742-1351160587000"
Content-Type: application/octet-stream
Accept-Ranges: bytes
Content-Length: 742
Connection: keep-alive

i think application/octet-stream is the correct content type. What am i doing wrong?

Thank you in advance for your answer

Regards, buk

An .ipa file is just a (not very well disguised) zip file (it's just renamed to .ipa ). Maybe when you set the generic application/octet-stream MIME-type, the Safari browser on iOS looks at the actual contents of the file, finds out that it's actually a ZIP archive and proceeds. By the way, it seems to me that you want to do some in-house or ad-hoc distribution of iOS apps. In this case, you should really direct the user towards the manifest.plist file which (an URL beginning with itms-services:// ) in order iOS to know that it needs to look for an application bundle and then download and install it.

Documentation here.

Follow these steps below:

  1. Upload .ipa file to your server
  2. Create a file <app_name>.plist with content as below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
    <dict>
        <key>assets</key>
        <array>
            <dict>
                <key>kind</key>
                <string>software-package</string>
                <key>url</key>
                <string>https://www.anysite.com/application/your_app.ipa</string>
            </dict>
        </array>
        <key>metadata</key>
        <dict>
            <key>bundle-identifier</key>
            <string>com.example.helloworld</string>
            <key>bundle-version</key>
            <string>1.0.0</string>
            <key>kind</key>
            <string>software</string>
            <key>title</key>
            <string>App Name</string>
        </dict>
    </dict>
</array>
</dict>
</plist>

Replace " bundle-identifier " and " title " with your value.

  1. Upload .plist file to your server
  2. Create a link in a HTML file as below:
<a href="itms-services://?action=download-manifest&amp;url=https://www.anysite.com/application/your_app.plist">
Download
</a>
  1. Use your iphone, open a browser and go to that page, click "Download" link. Your IPhone will install the app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM