I have the plugin Secure Storage installed. And built my own service.
Please refer:
@Injectable()
export class SecureStorageService {
private secureObject: SecureStorageObject;
private password: string;
constructor(private secureStorage: SecureStorage) {
this.secureStorage.create('secureStorage')
.then((secureStorageObject: SecureStorageObject) => this.secureObject = secureStorageObject);
}
init() {
this.secureObject.get('password').then(data => this.password = data);
}
savePassword(password: string) {
this.secureObject.set('password', password).then(data => this.password = data);
}
getPassword(): string {
return this.password;
}
}
and got this Error:
polyfills.js:3 Unhandled Promise rejection: Cannot read property 'split' of undefined ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property 'split' of undefined
at get (util.js:5)
at getPlugin (util.js:37)
at checkAvailability (plugin.js:20)
at index.js:43
at SecureStorage.create (index.js:48)
at new SecureStorageService (secure-storage.service.ts:10)
at _createClass (core.js:10933)
at _createProviderInstance$1 (core.js:10907)
at resolveNgModuleDep (core.js:10892)
at _createClass (core.js:10941) TypeError: Cannot read property 'split' of undefined
at get (http://localhost:8100/build/vendor.js:65169:22)
at getPlugin (http://localhost:8100/build/vendor.js:65201:12)
at checkAvailability (http://localhost:8100/build/vendor.js:76250:86)
at http://localhost:8100/build/vendor.js:76192:102
at SecureStorage.create (http://localhost:8100/build/vendor.js:76197:11)
at new SecureStorageService (http://localhost:8100/build/main.js:9456:28)
at _createClass (http://localhost:8100/build/vendor.js:11259:20)
at _createProviderInstance$1 (http://localhost:8100/build/vendor.js:11233:26)
at resolveNgModuleDep (http://localhost:8100/build/vendor.js:11218:17)
at _createClass (http://localhost:8100/build/vendor.js:11267:32)
App Informations:
Ionic:
ionic (Ionic CLI) : 4.10.2 (C:\Users\yusuf.azal\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.3
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 13 other plugins)
System:
Android SDK Tools : 26.1.1 (C:\Users\xl\AppData\Local\Android\Sdk)
NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
npm : 6.1.0
OS : Windows 10
I have installed 2 Version from SecureStorage 4.x and 3.0.0 and had the same Problem