HTML5 发布测试版本,通过网页在线安装ipa和apkH

来源:互联网 发布:java解析器是什么 编辑:程序博客网 时间:2024/06/18 12:55

//联系人:石虎  QQ: 1224614774昵称:嗡嘛呢叭咪哄

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的编译配置如下:

[plain] view plain copy
 
 在CODE上查看代码片派生到我的代码片
  1. ./configure --with-http_ssl_module --with-openssl=../openssl-0.9.8zh  
  2. make  
  3. make install  

2、Nginx的配置如下(关键看https的部分)

[plain] view plain copy
 
 在CODE上查看代码片派生到我的代码片
  1. user  root;  
  2. worker_processes  1;  
  3.   
  4. #error_log  logs/error.log;  
  5. #error_log  logs/error.log  notice;  
  6. #error_log  logs/error.log  info;  
  7.   
  8. #pid        logs/nginx.pid;  
  9.   
  10.   
  11. events {  
  12.     worker_connections  1024;  
  13. }  
  14.   
  15.   
  16. http {  
  17.     include       mime.types;  
  18.     default_type  application/octet-stream;  
  19.   
  20.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '  
  21.     #                  '$status $body_bytes_sent "$http_referer" '  
  22.     #                  '"$http_user_agent" "$http_x_forwarded_for"';  
  23.   
  24.     #access_log  logs/access.log  main;  
  25.   
  26.     sendfile        on;  
  27.     #tcp_nopush     on;  
  28.   
  29.     #keepalive_timeout  0;  
  30.     keepalive_timeout  65;  
  31.   
  32.     #gzip  on;  
  33.   
  34.     server {  
  35.         listen       80;  
  36.         server_name  127.0.0.1;  
  37.   
  38.         #charset koi8-r;  
  39.   
  40.         #access_log  logs/host.access.log  main;  
  41.   
  42.         location /ios_test {  
  43.                 root   /mnt/langresser/download/;  
  44.                 index  index.html index.htm;  
  45.         }  
  46.   
  47.     location /ipa_test {  
  48.         alias /mnt/langresser/download/;  
  49.         add_header Content-Dispositoin "attachment";  
  50.     }  
  51.         #error_page  404              /404.html;  
  52.   
  53.         # redirect server error pages to the static page /50x.html  
  54.         #  
  55.         error_page   500 502 503 504  /50x.html;  
  56.         location = /50x.html {  
  57.             root   html;  
  58.         }  
  59.   
  60.         # proxy the PHP scripts to Apache listening on 127.0.0.1:80  
  61.         #  
  62.         #location ~ \.php$ {  
  63.         #    proxy_pass   http://127.0.0.1;  
  64.         #}  
  65.   
  66.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000  
  67.         #  
  68.         #location ~ \.php$ {  
  69.         #    root           html;  
  70.         #    fastcgi_pass   127.0.0.1:9000;  
  71.         #    fastcgi_index  index.php;  
  72.         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;  
  73.         #    include        fastcgi_params;  
  74.         #}  
  75.   
  76.         # deny access to .htaccess files, if Apache's document root  
  77.         # concurs with nginx's one  
  78.         #  
  79.         #location ~ /\.ht {  
  80.         #    deny  all;  
  81.         #}  
  82.     }  
  83.   
  84.   
  85.     # another virtual host using mix of IP-, name-, and port-based configuration  
  86.     #  
  87.     #server {  
  88.     #    listen       8000;  
  89.     #    listen       somename:8080;  
  90.     #    server_name  somename  alias  another.alias;  
  91.   
  92.     #    location / {  
  93.     #        root   html;  
  94.     #        index  index.html index.htm;  
  95.     #    }  
  96.     #}  
  97.   
  98.   
  99.     # HTTPS server  
  100.     #  
  101.     server {  
  102.         listen       443 ssl;  
  103.         server_name  127.0.0.1;  
  104.     ssl on;  
  105.         ssl_certificate      /usr/local/nginx/conf/server.crt;  
  106.         ssl_certificate_key  /usr/local/nginx/conf/server_nopwd.key;  
  107.     #autoindex on;  
  108.     #autoindex_exact_size off;        
  109.   
  110.     location /ios {  
  111.                 root   /mnt/langresser/download/;  
  112.         index index.html index.htm;  
  113.     }  
  114.   
  115.     location /ipa {  
  116.         alias /mnt/langresser/download/;  
  117.         add_header Content-Dispositoin "attachment";  
  118.     }  
  119.   
  120. }  
  121.     #    ssl_session_cache    shared:SSL:1m;  
  122.     #    ssl_session_timeout  5m;  
  123.   
  124.     #    ssl_ciphers  HIGH:!aNULL:!MD5;  
  125.     #    ssl_prefer_server_ciphers  on;  
  126.   
  127.     #    location / {  
  128.     #        root   html;  
  129.     #        index  index.html index.htm;  
  130.     #    }  
  131.     # }  
  132.   
  133. }  

3、ipa生成的时候会同时生成一个manifest.plist。这个要进行一些修改,主要是服务器ip地址。例子如下:

[plain] view plain copy
 
 在CODE上查看代码片派生到我的代码片
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
  3. <plist version="1.0">  
  4. <dict>  
  5.     <key>items</key>  
  6.     <array>  
  7.         <dict>  
  8.             <key>assets</key>  
  9.             <array>  
  10.                 <dict>  
  11.                     <key>kind</key>  
  12.                     <string>software-package</string>  
  13.                     <key>url</key>  
  14.                     <string>https://127.0.0.1/ipa/thirtysix.ipa</string>  
  15.                 </dict>  
  16.                 <dict>  
  17.                     <key>kind</key>  
  18.                     <string>display-image</string>  
  19.                     <key>url</key>  
  20.                     <string>https://127.0.0.1/ipa/thirtysix57.png</string>  
  21.                 </dict>  
  22.                 <dict>  
  23.                     <key>kind</key>  
  24.                     <string>full-size-image</string>  
  25.                     <key>url</key>  
  26.                     <string>https://127.0.0.1/ipa/thirtysixfull.png</string>  
  27.                 </dict>  
  28.             </array>  
  29.             <key>metadata</key>  
  30.             <dict>  
  31.                 <key>bundle-identifier</key>  
  32.                 <string>com.jzsj.thirtysix</string>  
  33.                 <key>bundle-version</key>  
  34.                 <string>1.0</string>  
  35.                 <key>kind</key>  
  36.                 <string>software</string>  
  37.                 <key>title</key>  
  38.                 <string>三十六计</string>  
  39.             </dict>  
  40.         </dict>  
  41.     </array>  
  42. </dict>  
  43. </plist>  

4、一个测试页面如下(index.html,配置在nginx中)

[html] view plain copy
 
 在CODE上查看代码片派生到我的代码片
  1. <!DOCTYPE html>  
  2. <html>  
  3. <head>  
  4.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  5.   <title>游戏Demo</title>  
  6. </head>  
  7. <body>  
  8. <h1>1. iOS安装 <a href="https://127.0.0.1/ipa/server.crt">证书</a><br/>(如果之前尚未安装过此证书,请先安装证书)</h1>  
  9. <br/>  
  10. <h1>2. iOS安装 <a href="itms-services://?action=download-manifest&url=https://127.0.0.1/ipa/manifest.plist">游戏包</a></h1>  
  11. <br/>  
  12. <h1>3. Android安装 <a href="https://127.0.0.1/ipa/thirtysix.apk">游戏包</a></h1>  
  13. </body>  
  14. </html>  

5、经过如上配置,就部署完一个Nginx服务器,用户在Safari中访问对应的ip地址(注意要通过https来访问,不要直接输入ip地址,因为默认是http)就可以看到index.html页面。用户先安装并信任证书(https的证书),然后点击对应的链接可以调用操作系统的服务来自动下载安装应用。
0

阅读全文
0 0