Ionic 2 Expand code not working for automatic updates (ios)

I am new to using Ionic and not sure if my code is correct. What I am trying to achieve is to check the device for updates and install / reload the app if there is one.

I tried linking the code from the existing Ionic 2 documentation, but it doesn't seem to work for me.

Here is the code I have in my app.component.ts file:

import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';
import { HomePage } from '../pages/home/home';
import { Deploy } from '@ionic/cloud-angular';


@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage = HomePage;

  constructor(platform: Platform,public deploy: Deploy,public plt: Platform)
  {

    //Checks if the app is running on a mobile device
    if(this.plt.is('cordova'))
    {
      //Checks for application updates and reloads if needed
      this.deploy.check().then((snapshotAvailable: boolean) =>
      {
        if (snapshotAvailable)
        {
          this.deploy.download().then(() =>
          {
            this.deploy.extract().then(() =>
            {
              deploy.load();
            })
          });
        }


      });
    }



    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
      Splashscreen.hide();
    });
  }
}

      

I have deployed this app to iPad with the latest iOS. I used XCode (Enterprise App) and not Ionic View. I also took care to use the ionic boot / deploy commands and check my account to make sure my downloads are showing up on my Ionic account. However, despite all this, the application does not automatically update.

+3


source to share





All Articles