2016-09-20 102 views
1

我想在離子本地SecureStorage在創建失敗離子本地

let secureStorage: SecureStorage = new SecureStorage(); 
secureStorage.create('my_store_name') 
.then(
    () => console.log('Storage is ready!'), 
    error => console.log(error) 
); 

使用SecureStorage但我得到的錯誤「undefined is not a constructor (evaluating 'new cordova.plugins.SecureStorage(res, rej, store)')」在iPhone 5S

任何想法?

回答

0

我有一個供應商的代碼和它的作品對我來說...:

...  
 
public virtual: boolean = true; 
 
    public ss: SecureStorage; 
 

 
    constructor(
 
     private _http: Http, 
 
     private _config: ConfigurationService, 
 
     private _events: Events) { 
 
     
 
     this.virtual = Device.device.isVirtual; 
 
     if (this.virtual !== undefined && !this.virtual) { 
 
      console.log(`Using SecureStorage`); 
 
      this.ss = new SecureStorage(); 
 
      this.ss.create('ss') 
 
       .then(
 
       () => { 
 
        this.virtual = false; 
 
        this._events.publish('StorageReady'); 
 
       }, 
 
       error => console.log(error) 
 
       ); 
 
     } else { 
 
      console.log(`Using localstorage for simulation`); 
 
      this.virtual = true; 
 
     } 
 
    } ....

希望它可以幫助...

+0

感謝您的答覆..我的問題在再次安裝SecureStorage ion-native插件後得到修復。 –