在线安装开发ipa文件测试iOS APP

作者 FarLee 2016年9月18日 18:57:31   ‖浏览(7,610)

iOS APP 在没有提交到苹果官方app store之前, 需要测试app时, 通常开发人员会导出ipk安装文件, 在将测试人员设备的uuid添加到开发者后台之后, 通过电脑安装的itunes安装ipk文件到数据线连接的设备上(未越狱). 这种方式需要安装itunes, 需要连接数据线, 需要依次发送安装文件给测试人员.

不通过itunes软件, 在线安装iOS app则更方便, 测试人员只需在设备的safari浏览器打开安装网址点击安装即可, 局域网或者公网都很方便. 下面记录部署过程, 主要几个步骤;

  1. 测试设备的uuid添加到苹果开发者后台;  通过itunes获取到uuid登录developer.apple.com添加即可.
  2. 因为自iOS7开始, ota在线安装方式只支持https, 不能再使用http,  所以需要部署ssl:   生成自签名证书, 部署https服务器;  下面以ubuntu 14.04 和 nginx为例.

第一步 创建ssl证书

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt

加上-nodes 则nginx在启动时,可以不用输入ssl密码.

出现的输入框中依次添加国家省份代码等, 最重要的是 “Common Name (e.g. server FQDN or YOUR name)” 部分需要填写需要使用的域名或ip. 如 192.168.1.100;

最后生成了key和证书在/etc/ssl目录下;

为了让密钥传输更加安全, 使用Diffie-Hellman加强安全性:

sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

第二步 配置nginx启用ssl

sudo vi /etc/nginx/snippets/self-signed.conf  写入:

ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;

sudo vi /etc/nginx/snippets/ssl-params.conf 写入:

# from https://cipherli.st/
# and https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_ecdh_curve secp384r1;
ssl_session_cache shared:SSL:10m;
#ssl_session_tickets off;
#ssl_stapling on;
#ssl_stapling_verify on;
ssl_stapling off;
ssl_stapling_verify off;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;
# Disable preloading HSTS for now. You can use the commented out header line that includes
# the "preload" directive if you understand the implications.
#add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;

ssl_dhparam /etc/ssl/certs/dhparam.pem;

sudo vi /etc/nginx/sites-available/default 加入https 的server部分:

# HTTPS server
#
server {
# listen 443;
  listen 443 ssl;
# listen 443 ssl http2 default_server;
# listen [::]:443 ssl http2 default_server;
  server_name 192.168.1.100;

  root /data/app;
  index index.html index.htm;

  include snippets/self-signed.conf;
  include snippets/ssl-params.conf;

# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
# ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
# ssl_prefer_server_ciphers on;

  location / {
    try_files $uri $uri/ =404;
  }
}

保存退出, 随后重启nginx.

(注, 如果开发环境是vagrant虚拟机上部署nginx, 配置局域网ip的需要将443的端口转发加上)

第三步 配置plist和ipk地址

https 服务器部署好, 复制相关文件内容.

sudo vi /data/app/app.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://192.168.1.100/test.ipa</string>
 </dict>
 </array>
 <key>metadata</key>
 <dict>
 <key>bundle-identifier</key>
 <string>com.test.target</string>
 <key>bundle-version</key>
 <string>1.6.0</string>
 <key>kind</key>
 <string>software</string>
 <key>releaseNotes</key>
 <string>1.6版本发布</string>
 <key>title</key>
 <string>iOS 测试</string>
 </dict>
 </dict>
 </array>
</dict>
</plist>

sudo vi /data/app/index.html  写入:

<html>
<body>
<a href="itms-services://?action=download-manifest&url=https://192.168.1.100/app.plist" class="app_link">点击安装APP</a>
<br><br><br><br>
<a title="iPhone" href="https://192.168.1.100/nginx-selfsigned.crt">证书安装</a>
</body>
</html>

以上将 test.ipa 和 nginx-selfsigned.crt ,app.plist 以及bundle-identifier 修改成自己的.

在设备浏览器上打开网页https://192.168.1.100/, 第一步先点击证书安装, 不安装证书会提示无法连接到192.168.1.100的提示;
以后需要删除证书可以在通用里找到描述文件删除即可.

然后点击安装app即会弹出提示安装的对话框, 若点击安装没有任何反应, 确认设备有无安装过同一bundle id的正式版APP, 需要先卸载.


Trackbacks/Pingbacks

  1. Nginx 配置文件服务器下载apk和ipa | 技术联盟

来说兩句