I am writing one of my first apps using ionic + ngCordova + $cordovaSQLite plugin. I have some code that seems to work fine using the android emulator but not so much in the ios emulator. Here’s my startup code:
.run(function($ionicPlatform, $cordovaSQLite) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
db = $cordovaSQLite.openDB({name: dbname});
console.log('db opened 2: ' + JSON.stringify(db));
$cordovaSQLite.execute(db, "CREATE TABLE IF NOT EXISTS user (id integer primary key, firstname text, lastname text, password text, email text, username text)");
});
})
In the android emulator this code gives me no errors and when I do something later like insert a user into the table it completes successfully. In the ios emulator the openDB call works and the DB gets created successfully which I proved with the console log. The execute call that I make next fails. All I get for an error in the console is “new transaction is waiting for open operation”. I believe I am using all the latest stuff: ionic cli, cordova, ngCordova, sqlite plugin from brodysoft.
Any insights on this greatly appreciated. I have Googled quite heavily already…