从Amazon Aws s3 iOS下载App更新OTA

时间:2015-06-29 13:35:58

标签: ios amazon-s3 plist ipa

我希望在应用更新中创建,目前我的应用为我的亚马逊中的plist文件创建了一个签名网址s3存储桶,我还为我的.ipa文件创建了一个已签名的网址并存储在我的plist文件中签名的URL,如下所示:

应用程序中的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等的签名网址。

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>

当您将网址插入浏览器时,网址正在运行,但是,当点击该链接时,该应用无法下载该应用。

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

欢呼声, 本

1 个答案:

答案 0 :(得分:2)

我自己解决了这个问题,对于那些将来需要这些信息的人来说:

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

我发现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>

我希望将来可以帮助某人。