Native Storage无法在我的Ionic应用程序上运行


import { NativeStorage } from '@ionic-native/native-storage/ngx';
...
constructor(
private nativeStorage: NativeStorage
) {
}
setValue() {
console.log('start')
this.nativeStorage.setItem('prop', 'value')
this.nativeStorage.setItem('prop2', 'value2')
console.log('end')
}
...

当我调用setValue((console.log('start'(运行时,但第二个不起作用

如果我用打电话,那么控制台中仍然没有任何内容

this.nativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})
.then(
() => console.log('Stored item!'),
error => console.error('Error storing item', error)
);

使用代码一切正常

问题是在处理从.pipe(tap(this.setValue((((调用setValue(((的方法时,我无法在其中调用this.nativeStorage

最新更新