Upvote:7

 NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database))

More Answer related to the Same Query

Upvote:1

-(void) checkAndCreateDatabase{

    BOOL success;

    NSFileManager *fileManager = [NSFileManager defaultManager];

    success = [fileManager fileExistsAtPath:databasePath];

    if(success) return;

    NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"mydb.sqlite"];

    [fileManager copyItemAtPath:databasePathFromApp toPath:databasePath error:nil];

}

Credit Goes to: stackoverflow.com

Related question with same questions but different answers