首页 > 解决方案 > 减少内存空间的离子存储问题

问题描述

我在我的应用程序中使用离子存储,它需要近 1GB 的设备空间来启动应用程序。如果设备内存没有至少 1GB 的空间应用程序将不会启动。清除该内存后,我就可以启动了。

这样,我在登录到本地存储后尝试保存一些数据。

const seq = this.api.post('signin', value).share();
    seq.subscribe((res: any) => {
      // If the API returned a successful response, mark the user as logged in
      if (res.statusCode === 200) {
        (window as any).FirebasePlugin.setUserProperty('loggedInUserId', res.user);
        this.passwordMismatch = '';
        this.invalidSinIn = false;
        const isExistingUser = true;
        // store details into ionic storage
        Promise.all([this.storage.set('user', res.user), this.storage.set('token', res.token),
        this.storage.set('isVerified', res.isVerified), this.storage.set('authType', 'email'),
        this.storage.set('refreshToken', res.refreshToken), this.storage.set('referalCode', res.referalCode),
        this.storage.set('existingUser', isExistingUser), this.storage.set('isProfileCompleted', res.isProfileCompleted)]).then(() => {
          this.navCtrl.setRoot(MainPage);
        });
      }
    });

如果设备的可用空间大于 1GB,这可以正常工作,但如果内存较少,则会失败。

请帮我解决这个问题。我是新的离子我正在使用

离子框架:3.9.2

离子应用脚本:3.1.2

角核心:5.0.0

标签: ionic-frameworkionic3ionic-nativeionic-storage

解决方案


推荐阅读