Hi I'm trying to create an sqlite database in ios. I use the method sqlite3_open with the params needed but i always get the error 14 (SQLITE_CANTOPEN 14 /* Unable to open the database file */).
It does't work even with its simplest declaration
NSFileManager *fileMgr = [NSFileManager defaultManager];
NSString *dbPath = [[[NSBundle mainBundle] resourcePath ]stringByAppendingPathComponent:@"data.sqlite3"];
BOOL success = [fileMgr fileExistsAtPath:dbPath];
sqlite3 *db;
if(!success)
{
NSLog(@"Cannot locate database file '%@'.", dbPath);
}
if(!(sqlite3_open([dbPath UTF8String], &db) == SQLITE_OK))
{
NSLog(@"An error has occured.");
}
else{
NSLog(@"Ok");
}
Any ideas what's happening?
Thanks.
NSLog(@"SQLite errmsg = %s", sqlite3_errmsg());, to get the text error message.