话说ionic是真坑,文档质量就很差,版本兼容性也不好。最近要搞ionic sqlite开发,期间遇到问题:

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'split' of undefined
TypeError: Cannot read property 'split' of undefined

根据报错发现是调用 sqlite.create 方法时报的,

在stackoverflow上找到了答案

https://stackoverflow.com/questions/56223985/cannot-read-property-split-of-undefined-sqlite-ionic-v3-sqlite

在ionic3.x上使用 ionic-native/sqlite 5.x 就会报这个错。

解决方法:

卸载 ionic-native/sqlite 5.x,

npm uninstall -S @ionic-native/sqlite

安装4.x.x的版本

npm i -S @ionic-native/sqlite@^4.0.0

并且要将

import { SQLite, SQLiteObject } from '@ionic-native/sqlite/ngx';

改为

import { SQLite, SQLiteObject } from '@ionic-native/sqlite';

 

相关文章:

  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
相关资源
相似解决方案