从Amazon AWS S3下载iOS应用程序更新OTA

7

我希望创建应用内更新,目前我的应用在Amazon S3存储桶中为我的plist文件创建了签名URL,我还为我的.ipa文件创建了签名URL,并将该签名URL存储在我的plist文件中,如下所示:

应用中的URL调用:

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]];

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

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://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>

当您将链接插入浏览器时,链接有效,但是当单击链接时,应用程序不会像应该下载应用程序。

我已经尝试对plist中的url进行url编码,但无济于事。 plist的内容类型为:text/plain ipa的内容类型为:application/octet-stream

谢谢, 本

2个回答

8
我已经解决了这个问题,对于未来需要这些信息的人: 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>

我希望这能帮助未来有需要的人。

1

在我的情况下,我用&#38;替换了&

如果我使用&amp;代替&,它不起作用。


这并没有真正回答问题。如果您有不同的问题,可以通过点击提问来提出。如果您想在此问题获得新的答案时得到通知,您可以关注此问题。一旦您拥有足够的声望,您还可以添加悬赏以吸引更多关注。- 来自审核 - Ethan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接