from: http://blog.csdn.net/langresser_king/article/details/51351467
很多时候我们需要发布一个测试版本,如果发布为安装包,让测试人员自己安装的话,很多时候是非常困难麻烦的,尤其是iOS版本,多数人并不知道除AppStore之外的安装方式。
通过网页在线安装可以达成自动化部署,终端测试用户只需要通过页面下载安装即可。也可以免去发包给发行商的步骤,分享一个链接地址,他们点击链接即可完成安装。
Android版本很好处理,只需要部署好一台静态文件服务器,Android设备都可以自己下载安装。这里主要说明iOS的在线安装方式。
ios在线安装的步骤简单来说就是部署一台https文件服务器(Nginx),生成好openssl证书,将app用AdHoc或者企业版本证书签名。这样用户只需要通过Safari访问页面就可以安装了。 这里要说明一下,使用企业版本证书签名的app是不能够上传到app store上面的,但是任何设备都可以下载安装该app。 通过AdHoc签名的app需要终端用户设备的udid加入到该签名的.mobileprovision中才能安装。没有加入udid的用户是不能够安装的。
具体步骤如下:
1、部署一台https服务器。这里我们使用的是Nginx(也可以使用Apache的httpd)。注意必须要是https的服务器,否则无法启动iOS的安装功能。
安装Nginx在Linux上可以参考这里,需要安装一些依赖库(如pcre)。
openssl需要0.9.8的版本,不要1.0的版本。Nginx的编译配置如下:
- ./configure --with-http_ssl_module --with-openssl=../openssl-0.9.8zh
- make
- make install
2、Nginx的配置如下(关键看https的部分)
3、ipa生成的时候会同时生成一个manifest.plist。这个要进行一些修改,主要是服务器ip地址。例子如下:
- <?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://127.0.0.1/ipa/thirtysix.ipa</string>
- </dict>
- <dict>
- <key>kind</key>
- <string>display-image</string>
- <key>url</key>
- <string>https://127.0.0.1/ipa/thirtysix57.png</string>
- </dict>
- <dict>
- <key>kind</key>
- <string>full-size-image</string>
- <key>url</key>
- <string>https://127.0.0.1/ipa/thirtysixfull.png</string>
- </dict>
- </array>
- <key>metadata</key>
- <dict>
- <key>bundle-identifier</key>
- <string>com.jzsj.thirtysix</string>
- <key>bundle-version</key>
- <string>1.0</string>
- <key>kind</key>
- <string>software</string>
- <key>title</key>
- <string>三十六计</string>
- </dict>
- </dict>
- </array>
- </dict>
- </plist>
4、一个测试页面如下(index.html,配置在nginx中)
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>游戏Demo</title>
- </head>
- <body>
- <h1>1. iOS安装 <a href="https://127.0.0.1/ipa/server.crt">证书</a><br/>(如果之前尚未安装过此证书,请先安装证书)</h1>
- <br/>
- <h1>2. iOS安装 <a href="itms-services://?action=download-manifest&url=https://127.0.0.1/ipa/manifest.plist">游戏包</a></h1>
- <br/>
- <h1>3. Android安装 <a href="https://127.0.0.1/ipa/thirtysix.apk">游戏包</a></h1>
- </body>
- </html>
5、经过如上配置,就部署完一个Nginx服务器,用户在Safari中访问对应的ip地址(注意要通过https来访问,不要直接输入ip地址,因为默认是http)就可以看到index.html页面。用户先安装并信任证书(https的证书),然后点击对应的链接可以调用操作系统的服务来自动下载安装应用。