从 Amazon Aws s3 iOS 下载应用程序更新 OTA

Ben*_*Ben 2 amazon-s3 plist ios ipa

我正在寻找在应用程序更新中创建,目前我的应用程序在我的亚马逊是 s3 存储桶中为我的 plist 文件创建了一个签名的 url,我还为我的 .ipa 文件创建了一个签名的 url 并将该签名的 url 存储在我的 plist 文件中,如下所示:

应用中的网址调用:

NSMutableString *downloadURL = [NSMutableString string] ;
[downloadURL appendString:@"itms-services://?action=download-manifest&url="];
[downloadURL appendString:plistURL];
NSString *ipaDownloadString = [NSString stringWithString:downloadURL];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:ipaDownloadString]];
Run Code Online (Sandbox Code Playgroud)

其中 ipaDownloadString 是附加到 item-services://?action 等的签名 URL。

列表:

<?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://bucket_name.s3-eu-west-1.amazonaws.com/ipa_name.ipa?AWSAccessKeyId=xxxxxxxxxxxxx&Expires=1435587320&Signature=xxxxxxxxxxxx</string>
</dict>
            </array>
    <key>metadata</key>
        <dict>
            <key>bundle-identifier</key>
            <string>com.name.DropboxTest</string>
            <key>bundle-version</key>
            <string>1.1</string>
            <key>kind</key>
            <string>software</string>
            <key>title</key>
            <string>Dropbox Test</string>
        </dict>
    </dict>
     </array>
</dict></plist>
Run Code Online (Sandbox Code Playgroud)

当您将它们插入浏览器时,这些 url 正在工作,但是,当单击链接时,该应用程序不会像它应该下载的那样下载该应用程序。

我试过对 plist 中的 url 进行 url 编码,但无济于事。plist 具有 content-type: text/plain ipa 具有 content-type |: application/octet-stream

欢呼,本

Ben*_*Ben 5

我自己解决了这个问题,供以后需要这些信息的人使用:

plist 文件中的 url 需要签名,并且所述 url 中的“&”需要以 & 形式编码。

我发现 s3 上的内容类型根本不涉及这个问题。

我已经包含了一个示例 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>
        <!-- array of downloads. -->
        <key>items</key>
        <array>
            <dict>

                <!-- an array of assets to download -->
                <key>assets</key>
                <array>

                    <!-- software-package: the ipa to install. -->
                    <dict>

                        <!-- required.  the asset kind. -->
                        <key>kind</key>
                        <string>software-package</string>

                        <!-- required.  the URL of the file to download. -->
                        <key>url</key>
                        <string>https://s3-eu-west-1.amazonaws.com/bucket/path-to-ipa?AWSAccessKeyId=xxxxxxxxxxxxx&amp;Expires=1437661858&amp;Signature=xxxxxxxxxxxxxxxxxxxxxx</string>  

                    </dict>

                    <!-- display-image: the icon to display during download. -->
                    <dict>

                        <key>kind</key>
                        <string>display-image</string>

                        <key>url</key>
                        <string>link to image</string>
                    </dict>


                      <!-- full-size-image: the large 512×512 icon used by iTunes. -->
                    <dict>

                        <key>kind</key>
                        <string>full-size-image</string>


                        <key>needs-shine</key>
                        <true/>

                        <key>url</key>
                        <string>link to image</string>
                    </dict>
                </array>

                <key>metadata</key>
                <dict>

                    <!-- required -->
                    <key>bundle-identifier</key>
                    <string>com.hostname.appname</string>

                    <!-- optional (software only) -->
                    <key>bundle-version</key>
                    <string>1.2.5.0</string>

                    <!-- required.  the download kind. -->
                    <key>kind</key>
                    <string>software</string>

                    <!-- optional. displayed during download; -->
                    <!-- typically company name -->
                    <key>subtitle</key>
                    <string>Command Centre</string>

                    <!-- required.  the title to display during the download. -->
                    <key>title</key>
                    <string>Command Centre</string>
                </dict>
            </dict>
        </array>
    </dict>
</plist>
Run Code Online (Sandbox Code Playgroud)

我希望这对未来的人有所帮助。