Cordova PhoneGap 从 2.2.0 升级到 5.1.1
2022-09-01 17:51:00
我有Cordova应用程序,它是版本2.2.0。现在我想升级,我已经完成了升级部分,升级后,应用程序图像没有显示,它出现了空白屏幕。甚至初始屏幕也没有来。这是我的代码
现在我达到了一定程度。我模拟的应用程序是关于问题的。当开放数据库说db.cordova没有定义时SQLitePlugin
如何数据库安装 - 将数据库从数据库文件夹复制到Android安装位置。这工作正常。
这是我的数据库:
var DB = new Object();
DB.isDBSupported = false;
DB.isDBCreated = false;
DB.vocabDB = null;
DB.tables = ['userResponses', 'wordGroups', 'words', 'wordMapping', 'checkExists', 'patch_version']
DB.createdTables = 0;
DB.setupCallback = null;
DB.curQP = null;
DB.accountStatus = false;
DB.sfx = true;
DB.showWarnings = true;
DB.firstLaunch = false;
DB.initDB = function(callback) {
this.setupCallback = callback || function(){/*console.log("null function called")*/};
this.openDB();
var db = this;
if(!isPhoneGap()) {
_.delay(this.checkDB.bind(this), 500);
}
}
DB.checkDB = function() {
var db = this;
this.vocabDB.transaction(
function (t) {
t.executeSql('DROP TABLE checkExists', [], db.setupDBResultHandler.bind(db), db.setupDBErrorHandler.bind(db, ">>delete exists"))
}
)
}
DB.openDB = function() {
try {
if (!window.openDatabase) {
alert('Cannot open database!');
} else {
var shortName = 'sns2';
var version = '1.0';
var displayName = 'sns2';
var maxSize = (isAndroid()) ? 5242880 : 1000000;
if(!isPhoneGap()) {
this.vocabDB = window.openDatabase(shortName, version, displayName, maxSize, this.DBCreated);
} else if(isAndroid()) {
utils.log("ANDROID DATABASE .. ");
this.vocabDB = window.sqlitePlugin.openDatabase(shortName, version, displayName, maxSize, this.DBCreated);
} else if(isIOS()) {
utils.log("iOS DATABASE .. ");
this.vocabDB = window.sqlitePlugin.openDatabase(shortName, version, displayName, maxSize, this.DBCreated);
}
this.DBSupported = true;
if(isPhoneGap()) {
this.setupCallback();
}
}
} catch(e) {
alert("Unable to open db." + e.message);
return;
}
}
售后服务.js
function getGroupCategory(handler) {
console.log("selecting wordGroups");
DB.vocabDB
.transaction(function(t) {
t
.executeSql('SELECT * FROM categories', [], function(transaction, resultSet) {
handler(transaction, resultSet);
}, DB.transactionErrorHandler
.bind(DB, "Error while selecting wordGroups"));
})
}
当我调用此方法时,我得到这个错误消息表是avaibalecould not prepare statement(1 no such table) error code 5
请任何建议或想法..