[Solved] Ionic 4.0.0-beta-19: Native Storage Plugin Error

Hello,

I am trying to implement the native storage plugin in an Ionic app running 4.0.0-beta.19 on an iOS device.

The error I get when trying to call:
this.nativeStorage.getItem(‘variable_name_here’)

Error: Uncaught (in promise): Error
22

Here is my implementation:
app.component.ts

import { NativeStorage } from ‘@ionic-native/native-storage/ngx’
providers: [ NativeStorage ]

file.guard.ts

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

async canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Promise {

if (this.platform.is("cordova")) {
  const isComplete = await this.nativeStorage.getItem('variable_name');
}

The error happens on:
const isComplete = await this.nativeStorage.getItem(‘variable_name’);

Can anyone assist on this? Or is the plugin incompatible with this version of Ionic, if so, what are my alternatives?

Solved it, turns out I was trying to use this before the platform was ready.