ionic-native sqlite 插件5.x版的在ionic3.x上报错 cannot read property 'split' of undefined
Posted 爱生活爱编程
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ionic-native sqlite 插件5.x版的在ionic3.x上报错 cannot read property 'split' of undefined相关的知识,希望对你有一定的参考价值。
话说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/sqlite@^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的主要内容,如果未能解决你的问题,请参考以下文章
通过 git clone 为 Ionic 框架添加 SQLite 插件时出错
已安装插件(如 cordova-sqlite-storage)的问题
带有 SQLite 插件的 Phonegap 预填充 SQLite 数据库?与Phonegap 1.2 兼容吗?