TheCocoaProject / cordova-plugin-nativestorage

Cordova plugin: Native storage of variables in Android, iOS and Windows
http://thecocoaproject.github.io/
Apache License 2.0
292 stars 106 forks source link

Ionic 3 - No provider for NativeStorage #137

Closed JesseRMeyer closed 5 years ago

JesseRMeyer commented 5 years ago

Hi.

I've added this plugin following the instructions here : https://ionicframework.com/docs/native/native-storage/

However, whenever I try to use it, my app crashes complaining about a lack of a provider for NativeStorage. I'm not sure how to obtain the error message since it is displayed on my device itself and is not mirrored in the terminal.

My usage looks like :

import { NativeStorage } from '@ionic-native/native-storage/ngx';

export class class_name {
class variables ...
constructor(public navCtrl: NavController, public platform: Platform, private nativeStorage: NativeStorage) {
platform.ready().then(/* Do some bindings */);

// stuff with this.nativeStorage ...
}
}

instead of the empty constructor constructor(private nativeStorage: NativeStorage) { }

I doubt this is the cause of the no provider issue -- but I do not know whether this is a local issue with my installation / usage or with the plugin itself.

JesseRMeyer commented 5 years ago

The docs I pointed to are for ionic v4. The v3 installation docs provide the correct method on how to provide the provider.