NativeStorage getting error plugin_not_installed


#1

Here is my code, the plugin has been installed.

nativeStorage() {

  NativeStorage.setItem('email', "test@test.com")
    .then(
      () => console.log('Stored item!'),
      error => alert('Error storing item ' + error)
    );

  NativeStorage.getItem('email')
    .then(
      data => this.nativeMessage = data,
      error => alert(error)
    );

}

When I run the app in browser, It works fine
ionic run browser

When I run the app in the Ionic View app
ionic upload
I get the error plugin_not_installed

When I compile it with Ionic Package and install it on my iPhone, I get the same error, plugin_not_installed.

What am I doing wrong?

Thank you in advanced.


#2

Native Storage is not one of the supported plugins of Ionic View: https://docs.ionic.io/tools/view/#supported-plugins


#3

Thank you for the response, that explains Ionic View, do you have an idea why when it is installed on my iPhone I am getting the same error?


#4

No, sorry.

Why are you using Native Storage and not Ionic Storage? It’s much less error prone from what I read here in other posts: https://ionicframework.com/docs/storage/


#5

Ok thank you, I did no know Ionic Storage is a better option. Ill try it out tonight.


#6

Ok I was able to get that to work on Ionic View and my iPhone.
One thing to note is that I was getting the same error plugin_not_installed on other plugins Contacts and SocialShare. I had to add them to my app.module.ts providers. In the docs it does not say to do that.


#7

Great that it is working now!

You skipped a part of the docs: http://ionicframework.com/docs/native/#Add_Plugins_to_Your_App_Module (Many people make that mistake)