离子6应用程序使用电容器-社区/SQLite@3.4.2-3。
使用创建连接await CapacitorSQLite.createConnection({database:DBNAME,version:DB_VERSION,encrypted:false,mode:"secret"});
我收到以下错误:"While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length."
使用相同代码的3.4.0版本时,错误为:"Error: Query: Attempt to invoke virtual method 'com.getcapacitor.JSArray com.getcapacitor.community.database.sqlite.CapacitorSQLite.query(java.lang.String, java.lang.String, com.getcapacitor.JSArray)' on a null object reference"
有什么好主意吗?谢谢
1条答案
按热度按时间dauxcl2d1#
我面临着200万个问题,但我认为您在构造函数调用中放了一个多余的花括号
{}
,并且您正在直接调用对象。const db = await this.sqlite.createConnection(this.dbname, true, 'encryption', 1, false);
:其中,
this.sqlite
通过调用initializePlugin
在构造函数中启动为服务(Angular您的IMPORT语句中可能还需要以下内容:
至少,这对我来说很管用。