samedi 30 avril 2016

Cordova sqlite pre populated in iOS

i have a pre populated database which i put in www , it worked fine when building for android , now i have spent a whole day trying to compile it on iOS from mac and it loads the sqlite , i can create new tables and queries but i can not load my pre populated database like android , this is my code : can someone tell what i am doing wrong

var db;

function onLoad(){
    document.addEventListener("deviceready", onDeviceReady, false);
}

// Cordova is ready
    var onDeviceReady = function(){
        db = window.sqlitePlugin.openDatabase({name: "my.db",iosDatabaseLocation: 1});
        db.transaction(getFirst200,querySuccess,errorCB);
    };

    var querySuccess = function(){
        alert("success");
    };

    var errorCB = function(){
        alert("error");
    };

    var getFirst200 = function(tx){
        db.transaction(function(tx) {
                tx.executeSql('select * from nutrition_values Limit 200', [], querySuccess, errorCB);
            });
    };

Aucun commentaire:

Enregistrer un commentaire