0
votes

I am trying to learn core data. after following few online tutorials I have created a sample iPhone app. the app is working fine. i can save data and search in the database.

The problem I am having is I can't browse the database in my mac. I am using 'SQLite Database Browser'. in the app folder there are three SQLite files (with extension .sqlite, .sqlite-shm and .sqlite-wal) I can open the .sqlite file, but I don't see any table in the file. (I think the table is still in the temporary files. or is it?)

couldn't post the screenshot of the database folder, as i don't have enough reputation :-(

Here is the code I am using to save data:

NSEntityDescription *entitydesc = [NSEntityDescription entityForName:@"Person" inManagedObjectContext:context];

NSManagedObject *newPerson = [[NSManagedObject alloc]initWithEntity:entitydesc insertIntoManagedObjectContext:context];

[context hasChanges];

[newPerson setValue: self.firstName.text forKey:@"firstname"];
[newPerson setValue: self.lastName.text forKey:@"lastname"];


NSError *error;
[context hasChanges];
[context save:&error];

_displayLabel.text = [NSString stringWithFormat:@"person added"];

I have developed app with SQLite database before and I didn't have any issue browsing database. Before I start implementing core data to my app, I wanted to know if this problem is going to cause me headeche down the track. or is it something i can ignore.

1
Does your SQLite browser support the WAL mode which Core Data uses since iOS 7 ? - Martin R
Thanks for your response Martin. I don't think the SQLite browser I am using supports WAL mode. do you know any browser that support WAL mode? - Isti

1 Answers

0
votes

Your SQLite file is using WAL mode as Martin mentioned. You can vacuum the database to see the data or just let it perform as it is working as intended.

Further discussion on this topic can be found at CoreData database not showing in sqlite since moving to Xcode 5