How to open a core data database?

core-data, database, persistence, sqlite

Solution

You should be able to view the database directly using the sqlite3 command line tool. The database should be stored in the following directory:

~/Library/Application Support/iPhone Simulator/User/Applications/{your application GUID}/Documents/{your application name}.sqlite

To view the database, just type in the following in a terminal (note, sqlite3 should already be installed on your system by default):

sqlite3 {your application name}.sqlite

You can then run regular SQL to view the data in the database.

Note, the following useful commands:

- .help - Shows sqlite specific commands and what they do

- .tables - Shows all tables in the database

- .schema {followed by table name} - Shows the create statement used to create the table

- .quit - Exits sqlite3

Problem

Is there any way in which I can view my core data database without having to load it programatically through the code?!

Original source