案例:我正在为 Ionic 2 应用程序使用 iOS 企业程序。这种分发类型的问题之一是支持更新流。为了解决这个问题,我们在服务器端创建了简单的 JSON 来检查可用的更新。当更新可用时,用户会看到提示更新应用程序或退出的建议。
app.component.ts
iosUpdateCheck() {
this.http.get(`${this.config.iosEnterpriseEndpoint}latest.json`).map(res =>
<{version: string}>res.json()).subscribe((res) => {
if (res.version !== this.config.appVersionNumber) {
this.message.alertCtrl.create({
title: 'Update is available!',
message: 'Please, update your terminal to proceed',
buttons: [
{
text: 'Update',
handler: () => {
console.log(this.TAG + 'iosUpdateCheck: update clicked');
//I tried just href also
window.window.open(`<a href=itms-services://?action=download-manifest&url=${this.config.iosEnterpriseEndpoint}manifest.plist />`,'_system');
}
},
{
text: 'Exit',
role: 'cancel',
handler: () => {
console.log(this.TAG + 'iosUpdateCheck: exit clicked');
this.platform.exitApp();
}
},
]
}).present();
}
});
}
我还添加了config.xml
<allow-intent href="itms-services:*"/>
但仍然遇到相同的错误(抱歉,截图,无法在 Safari 中复制错误链接):
如果我只使用一个链接,它工作正常,但不符合所追求的目标。