It appears that when I copy a .sqlite3 file into iOS, and use FMDB
to access it, the database is empty. I just drag and drop it into Xcode. When I run:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:@"db.sqlite3"];
FMDatabase *db = [FMDatabase databaseWithPath:writableDBPath];
FMResultSet *results = [db executeQuery:@"SELECT * FROM tableName"];
results
returns nil. Looking at [db lastErrorMessage]
, it says my table does not exist. When I open up the .sqlite file in the command line (the one that is stored in the iPhone Simulator), I get an empty database. Is there a specific way to import a SQLite database into iOS? If so, how?