自建ios app发布服务器

2018-06-12  本文已影响69人  zhangwenqiang

1.html的写法:
1.1:android和ios共用一个二维码
goDownload() {

var u = navigator.userAgent, app = navigator.appVersion;

var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;

var isIOS = !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/);

// 这里是安卓浏览器

if (isAndroid) {

window.location.href = 'https://www.baidu.com/'; // 跳安卓端下载地址,此处用百度地址作为测试地址

}

// 这里是iOS浏览器

if (isIOS) {

window.location.href = 'http://www.sohu.com/'; // 跳AppStore下载地址,此处用搜狐地址作为测试地址

}

// 是微信内部webView

if (is_weixn()) {

alert("请点击右上角按钮, 点击使用浏览器打开");
}
}

// 是微信浏览器

function is_weixn() {

var ua = navigator.userAgent.toLowerCase();

if (ua.match(/MicroMessenger/i) == "micromessenger") {

return true;

} else {

return false;

}

}
1.2下载ios的html:
<html>
<head>
<meta charset="utf-8">
<title>hangge.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
</head>
<body>
<a href="itms-services://?action=download-manifest&url=https://www.hangge.com/ios/manifest.plist">点击开始安装App</a>
</body>
</html>
2.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>http://118.190.43.104:8080/apk/ttex.ipa</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.baima.ttex0</string>
<key>bundle-version</key>
<string>1.0</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>TTEX</string>
</dict>
</dict>
</array>
</dict>
</plist>

上一篇 下一篇

猜你喜欢

热点阅读