小编Ger*_*son的帖子

ionic3本机存储错误代码:2

使用ionic3的本机存储时出现错误。它无法正确读取本机存储中的数据。错误代码:2,但没有详细描述。

  public async getToken(): Promise<AccessToken> {
    let token = null;
    let expires = null;
    try{
      token = await this.storage.getItem(this.ACCESSTOKEN_KEY);
      expires = await this.storage.getItem(this.ACCESSTOKEN_EXPIRES_KEY);
    }catch(e){
      alert(JSON.stringify(e));
    }
    if (token == null || expires == null || expires < new Date()) {
      token = null;
    }
    return token;
  }
Run Code Online (Sandbox Code Playgroud)

错误截图

ionic3

1
推荐指数
1
解决办法
2020
查看次数

标签 统计

ionic3 ×1