话说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上找到了答案
在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/[email protected]^4.0.0
并且要将
import { SQLite, SQLiteObject } from ‘@ionic-native/sqlite/ngx‘;
改为
import { SQLite, SQLiteObject } from ‘@ionic-native/sqlite‘;
ionic-native sqlite 插件5.x版的在ionic3.x上报错 cannot read property 'split' of undefined
原文地址:https://www.cnblogs.com/johnjackson/p/11370265.html
时间: 2024-10-28 23:59:45