小编Tom*_*mas的帖子

SQLite 与 Ionic 4?无法读取未定义的属性“then” TypeError:无法读取未定义的属性“then”

首先我遇到了这个错误并解决了它。太好了。当我尝试使用我的设备进行调试时(使用ionic cordova run android)。数据库 SQL 未加载,它显示为没有或从未创建过数据库 sqlite。我检查控制台,我看到这个:

错误错误:未捕获(承诺):TypeError:无法读取 >undefined TypeError 的属性“then”:无法读取 AppComponent.push../src/app/app.component.ts.AppComponent.createDatabase 处未定义的属性“then” >(app.component.ts:101) 在 app.component.ts:87

在 app.component.ts 我有这个:

import { SQLite, SQLiteObject } from '@ionic-native/sqlite/ngx';
import { DbService } from './services/db/db.service';


rootPage: string = null;
constructor(
    private platform: Platform,
    private splashScreen: SplashScreen,
    private statusBar: StatusBar,
    private translate: TranslateService,
    private router: Router,
    private menuCtrl: MenuController,
    public DbService: DbService,
    public sqlite: SQLite
    //private screenOrientation: ScreenOrientation
  ) {
    this.initializeApp();
  }

  public TableCreated = "POR EL MOMENTO NO";
  public …
Run Code Online (Sandbox Code Playgroud)

sqlite android-sqlite ionic-framework angular ionic4

5
推荐指数
2
解决办法
8821
查看次数