Ionic4 beta - AppVersion plugin


#1

Getting an error when using the @ionic-native/app-version plugin with Ionic4 Beta.

Error
Object(…) is not a function --> index.js

Using these…
@ionic-native/core:5.0.0-beta.21,
@ionic/angular:4.0.0-beta.15-0,
@ionic-native/app-version:^4.17.0,
.
.
cordova-plugin-app-version:^0.1.9

In app.module.ts
import{ AppVersion } from '@ionic-native/app-version;
providers: […AppVersion…]


The same code is working fine in ionic3


#2

Interesting that you elide the very dependency that is giving you problems: @ionic-native/app-version itself. I’m going to speculate that it’s <v5.


#3

Have basically followed the instructions as in

have updated bug description as well. Same code works fine in Ionic3


#4
  • Open the search feature of the forum
  • Enter your error “Object(…) is not a function”
  • Click one of the previous post
  • Find the solution

#5

It’s not a bug. It’s pilot error. As I suspected, @ionic-native/app-version is <v5. All the ionic native stuff has to be on the same major version.


#6

yup… upgraded to version 5
@ionic-native/app-version:5.0.0-beta.21

corrected import statement as well
import {AppVersion} from ‘@ionic-native/app-version/ngx’;

Thanks for the tip.