简体   繁体   English

设置了正确的内容类型,但 .ipa 文件被视为 .zip 文件

[英]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.我编写了一个小型 Rails 应用程序,我可以在其中上传三个文件,我需要这些文件以无线方式分发临时构建。 This includes a .ipa File, a .mobileprovisioning File and a .plist File.这包括一个.ipa文件、一个.mobileprovisioning文件和一个.plist文件。

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.现在的问题是,当我单击.ipa文件的链接时,文件被视为正常下载,我的 iDevices 询问我将文件存储在哪里。

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.我认为application/octet-stream是正确的内容类型。 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 ). .ipa 文件只是一个(不是很好伪装的)zip 文件(它只是重命名为.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.也许当您设置通用的application/octet-stream MIME-type 时,iOS 上的 Safari 浏览器会查看文件的实际内容,发现它实际上是一个 ZIP 存档并继续。 By the way, it seems to me that you want to do some in-house or ad-hoc distribution of iOS apps.顺便说一句,在我看来,您希望对 iOS 应用程序进行一些内部或临时分发。 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.在这种情况下,您应该真正将用户引导至 manifest.plist 文件(以itms-services://开头的 URL),以便 iOS 知道它需要查找应用程序包,然后下载并安装它。

Documentation here. 文档在这里。

Follow these steps below:请按照以下步骤操作:

  1. Upload .ipa file to your server将 .ipa 文件上传到您的服务器
  2. Create a file <app_name>.plist with content as below:创建一个文件 <app_name>.plist,其内容如下:
<?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.将“ bundle-identifier ”和“ title ”替换为您的值。

  1. Upload .plist file to your server将 .plist 文件上传到您的服务器
  2. Create a link in a HTML file as below:在 HTML 文件中创建一个链接,如下所示:
<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.使用您的 iPhone,打开浏览器并转到该页面,单击“下载”链接。 Your IPhone will install the app.您的 iPhone 将安装该应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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