微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

类型错误:plugin.warn 不是 SQLitePluginTransaction.addStatement 的函数

如何解决类型错误:plugin.warn 不是 SQLitePluginTransaction.addStatement 的函数

在 React Native sqlite DB 的表中插入数据时出现以下错误

可能的未处理的承诺拒绝(id:0): 类型错误:plugin.warn 不是函数 类型错误:plugin.warn 不是函数sqlitePluginTransaction.addStatement (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:416247:18) 在 sqlitePluginTransaction.executesql (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:416228:10) 在 http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:415677:42 在 tryCallTwo (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27207:7) 在 doResolve (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27371:15) 在新的承诺 (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:27230:5) 在 sqlitePluginTransaction.plugin.. [as executesql] (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:415656:23) 在 sqlitePluginTransaction.fn (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:415583:15) 在 sqlitePluginTransaction.start (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:416184:12) 在 http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:415866:32

下面是将数据插入数据库代码

        return new Promise((resolve,reject) => {
            db.transaction((trans) => {
                trans.executesql(
                    sql,params,(trans,results) => {
                        resolve(results);
                    },(error) => {
                        reject(error);
                    }
                );
            });
        });
    }; ```

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。