jeudi 1 janvier 2015

Swift ios, sqlite, error 21 Library used incorrectly

I am a beginner in swift language (for IOS) and I am going to use sqlite in my program. I added the libsqlit3.dylib to my project and used bridging-header. (the wrapper is downloadded from : http://ift.tt/1yQD22a) I have run the following code :



var db = SQLiteDatabase();
db.open("test.db");
var statement = SQLiteStatement(database: db);
var sql = "CREATE TABLE IF NOT EXISTS CONTACTS (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, ADDRESS TEXT, PHONE TEXT)"

println("result : \(statement.prepare(sql))");


the result code is 21 which means "Library used incorrectly". the test.db file doesn't exist and expect it will be created.


I dont know what is the problem! please help me.


Aucun commentaire:

Enregistrer un commentaire