主要思路
- 生成根证书
- 搭建本地https代理服务器
- 下载mainifest.plist文件
- mainifest.plist文件中指向ipa地址
1. 证书生成
# 生成自签名根证书
openssl genrsa -out CA.key 2048
openssl req -x509 -new -key CA.key -out CA.cer -days 730 -subj /CN="My CA"
192.168.1.104 为本机IP地址
mycert 为证书名称
# 基于根证书 再生成一堆证书
openssl genrsa -out mycert.key 2048
openssl req -new -out mycert.req -key mycert.key -subj /CN=192.168.1.104
openssl x509 -req -in mycert.req -out mycert.cer -CAkey CA.key -CA CA.cer -days 365 -CAcreateserial -CAserial serial
2. 搭建本地服务器
# mac 平台下可以用homebrew来安装一个nginx
brew install nginx
nginx 配置 必须使用https
# HTTPS server
#
server {
listen 443 ssl;
server_name liu.local;
ssl_certificate /Users/Charlotte/Documents/Learning/itms/CA.cer;
ssl_certificate_key /Users/Charlotte/Documents/Learning/itms/CA.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
location / {
root /Users/Charlotte/Documents/Learning/itms/;
index index.html index.htm;
}
}
下载页面代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>ios应用安装</title>
<style>
.row {
text-align: left;
max-width: 500px;
margin: 0 auto;
}
</style>
</head>
<body style="text-align: center;">
<br>
<h1>ios应用安装</h1>
<br>
<div>
<a href="./CA.cer">先点我,下载CA证书</a>
</div>
<br>
<br>
<div>
<img src="./icon.png" alt="" style="border-radius: 4px;">
<div>
<a href="itms-services://?action=download-manifest&url=https://192.168.1.104/manifest.plist">然后点我安装</a>
</div>
</div>
<br>
<br>
<div>
<h2>常见问题</h2>
<div class="row">问题:无法连接到 "xx.xx.xx.xx"</div>
<div class="row">解决:【设置 > 通用 > 关于本机 > 证书信任设置】勾选信任</div>
<br>
<div class="row">问题:未受信任的企业级开发者</div>
<div class="row">解决:【设置 > 通用 > 描述文件与设备管理】添加到信任</div>
</div>
</body>
</html>
3. mainifest.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.104/ipaname.ipa</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>https://192.168.1.104/icon.png</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.company.projectname</string>
<key>bundle-version</key>
<string>4.6.2</string>
<key>kind</key>
<string>software</string>
<key>subtitle</key>
<string>subtitle</string>
<key>title</key>
<string>title</string>
</dict>
</dict>
</array>
</dict>
</plist>
网友评论