<plugin name = "cordova-plugin-wkwebview-engine" source = "npm" />
<platform name = "ios">
<preference name = "WKWebViewOnly" value = "true" />
<feature name = "CDVWKWebViewEngine">
<param name = "ios-package" value = "CDVWKWebViewEngine" />
</feature>
<preference name = "CordovaWebViewEngine" value = "CDVWKWebViewEngine" />
</platform>
the instruction I include in the Config and I show below does not work:
<plugin name = "cordova-sqlite-evcore-extbuild-free" source = "npm" />
so when running the application natively in IOS it is noticed:
Does declaring cordova-plugin-wkwebview-engine after setting the preferences make any difference?
<platform name = "ios">
<preference name = "WKWebViewOnly" value = "true" />
<feature name = "CDVWKWebViewEngine">
<param name = "ios-package" value = "CDVWKWebViewEngine" />
</feature>
<preference name = "CordovaWebViewEngine" value = "CDVWKWebViewEngine" />
</platform>
<plugin name = "cordova-plugin-wkwebview-engine" source = "npm" />
I have indicated it by testing at the beginning, in the middle and at the end and in all cases I indicate the same … “SQLite not supported”, however if not included it works fine.
I had to sterilize it a bit but this works for opening the db and creating the table.
// this function would open the database, create the table (if needed)
function init_db(callback)
{
let params = null;
// if we already have a handle we can skip this
if(myDB != null)
return;
switch(device.platform)
{
case "ios":
case "iOS":
params = {name: 'myAppDB', iosDatabaseLocation: 'default'};
break;
case "android":
case "Android":
params = {name: 'myAppDB', location: 'default'};
break;
}
myDB = window.sqlitePlugin.openDatabase(params, function() {
// console.log("creating the table after db open");
sqlCreateTable(function() {
if(typeof callback === "function")
{
callback();
}
});
}, function() {
popupDialog("<strong>Oh No!</strong><br>1029: Error Creating database.", {
'type': 'Error',
'title': 'Serious Device Problems'
});
exit(-1);
});
}
function sqlCreateTable(callback)
{
var db = myDB;
// msg_id, channel, type, title, text, when, contact
db.transaction(function(tx) {
tx.executeSql("CREATE TABLE IF NOT EXISTS mytable (msg_id UNSIGNED BIG INT PRIMARY KEY ASC, channel INTEGER, type INTEGER, msg_when TEXT, msg_read INTEGER, title TEXT, msg_text TEXT)",
[], sqlNullHandler, sqlOnError);
tx.executeSql("CREATE UNIQUE INDEX IF NOT EXISTS unique_id ON mytable (msg_id)",
[],
function() {
if(typeof callback === "function")
callback();
},
sqlOnError);
});
}
I’m going to try first what you sent me from the Config, Excellent.
The programming that you sent me earlier I see it a little more complicated, so I hope it works with the Config (I usually work in Basic, but I will test it if necessary).
Are you attempting to initialize your database before the deviceready event has fired? If so, the sqlite plugin will not be initialized and you will get the ‘SQLite not supported’ error.
In my projects, I was initializing the database in the Main() function which fired before the deviceready event so I was getting that same error. I had to re-write to delay the database initialization until after deviceready and now it works fine.
If your project needs to run both on a device and in a browser, then you actually have to detect whether you’re running on a device or not since the deviceready event won’t fire when running in the browser.
I tell you that I have tried what I have been told in the Config and the opportunity in which the database is created in sql and unfortunately it has not worked for me.
I have tried, creating a smaller program what PPetre told me and it did not go very well. So I cannot comment much in that case and because of my ignorance of that method.
What I can say is that removing:
“cordova-plugin-wkwebview-engine”
there, if it works but Apple does not allow the app to upload.
If you ever have the solution please post it in full.