Cordova-plugin-ionic not working => this.deploy.getCurrentVersion is not a function


#1

I want to use deploy and pro monitoring with iOS. Automatic deploy in background is working but I also want to be able to trigger a manual update from my app.

I followed the setup guide and added this to my app.module.

import { Pro } from '@ionic/pro';

Pro.init('MY_APP_ID', {
    appVersion: '1.0.0'
});

with ionic serve I get a console.log from Pro.

Ionic Pro initializing (app id: MY_APP_ID)

… and e.g…

Pro.monitoring.log('Checking version', { level: 'info' });

…works as expected.

On iOS I do not get any logs and no monitoring events in my ionic dashboard.

If I try to get the current version or try to update the app I get the following error in the XCode console.

ERROR: Unhandled Promise rejection: this.deploy.getCurrentVersion is not a function. (In 
'this.deploy.getCurrentVersion()', 'this.deploy.getCurrentVersion' is undefined) ; Zone: <root> ; Task: 
Promise.then ; Value: TypeError: this.deploy.getCurrentVersion is not a function. (In 
'this.deploy.getCurrentVersion()', 'this.deploy.getCurrentVersion' is undefined)

I logged Pro and window[‘IonicCordova’] with the following results in Xcode.

            console.log('PRO');
            console.log(Pro);
            console.log('PRODEPLOY');
            console.log(Pro.deploy);
            console.log('WINDOWIONICCORDOVA');
            console.log(window['IonicCordova']);

Pro => empty
Pro.deploy => {}
window[‘IonicCordova’] = {“deploy”: {}}

It seems like the plugin is not correctly injected into the page on the device.

    <plugin name="cordova-plugin-ionic" spec="5.2.5">
        <variable name="APP_ID" value="MY_APP_ID" />
        <variable name="CHANNEL_NAME" value="MY_CHANNEL" />
        <variable name="UPDATE_METHOD" value="background" />
        <variable name="UPDATE_API" value="https://api.ionicjs.com" />
        <variable name="MAX_STORE" value="2" />
        <variable name="MIN_BACKGROUND_DURATION" value="30" />
    </plugin>

Can anyone help?


#2

Same here. I need some help too.