简体   繁体   中英

iOS Enterprise update integration

the case: I'm using iOS Enterprise Program for Ionic 2 app. One of issues for such distribution type was in supporting update flow. To solve this, we created simple JSON on server side to check available update. When update is available, user sees alert with suggestion to update app or exit.

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();
          }
        });
      }

I also added in config.xml <allow-intent href="itms-services:*"/> but still getting same error(sorry for screenshot, it's impossible to copy error link in Safari): 在此处输入图片说明 If I will use just a link it works fine but does not correspond to the objectives pursued.

I think this ionic-native plugin might help you: Ionic Native Market plugin .

Installation:

ionic cordova plugin add cordova-plugin-market
npm install --save @ionic-native/market

And don't for get to add it to your app.module .

Usage:

import { Market } from '@ionic-native/market';
constructor(private market: Market) { }

this.market.open('your.package.name');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM