[英]Uncaught TypeError: Cannot call method 'openDatabase' of undefined - only from physical device
I am using SQLite plugin for cordova. 我正在为cordova使用SQLite插件。 I'm making a telerik mobile/kendo mobile app.
我正在制作telerik移动/剑道移动应用程序。 I use the telerik appBuilder windows client IDE.
我使用telerik appBuilder Windows客户端IDE。 I clicked plugins and checked the SQLite plugin check box to make sure it is integrated with my app.
我单击了插件,然后选中了SQLite插件复选框,以确保它与我的应用程序集成在一起。
When running the app from the simulator within the telerik appBuilder IDE, the app works fine. 从telerik appBuilder IDE中的模拟器运行该应用程序时,该应用程序运行良好。 But when I remote debug the app from my Android Nexus 5 or just try and use the app at all from the nexus 5, it stalls at the start.
但是,当我从Android Nexus 5远程调试应用程序时,或者只是尝试从nexus 5完全使用该应用程序时,它一开始就停滞了。 I can see in the remote debugger that it says
Uncaught TypeError: Cannot call method 'openDatabase' of undefined
about the line marked "HERE" in this function: 我可以在远程调试器中看到它说出
Uncaught TypeError: Cannot call method 'openDatabase' of undefined
在此函数中,关于标记为“ HERE”的行Uncaught TypeError: Cannot call method 'openDatabase' of undefined
:
app.openDb = function() {
if (window.navigator.simulator === true) {
// For debuging in simulator fallback to native SQL Lite
console.log("Use built in SQLite");
app.db = window.openDatabase("VCareMobileDB", "1.0", "Shopping List Demo", 200000);
}
else {
console.log("Using SQLite Plugin DB");
app.db = window.sqlitePlugin.openDatabase("VCareMobileDB"); //HERE
}
}
Why might this line trigger the error from a physical device and not from the telerik appbuilder simulator? 为什么此行可能触发来自物理设备而不是Telerik Appbuilder模拟器的错误?
Thanks. 谢谢。
You are using two different openDatabase API calls window.openDatabase
and window.sqlitePlugin.openDatabase
. 您正在使用两个不同的openDatabase API调用
window.openDatabase
和window.sqlitePlugin.openDatabase
。
For window.sqlitePlugin.openDatabase
you need to install the plugin. 对于
window.sqlitePlugin.openDatabase
您需要安装插件。
For window.openDatabase
you do not need to install any plugin. 对于
window.openDatabase
你不需要安装任何插件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.