Quick post for today, but a tip I find indispensable. When working with a database-driven app, I often find the need to directly access the database — to confirm that queries worked, to examine the data that was inserted, to tweak records for testing purposes, etc. To do this, we have to find the database.
The iOS simulator creates a series of folders buried deep inside the Library/Application Support/iPhone Simulator folder. In there, you’ll find a confusing list of simulator versions and app GUID folders. One of those holds your app and its database. Which one? You could hunt & peck till you find it. Or, use Simulator Folders from Nimbleworks.
This cool tool hangs in your Mac’s menu bar. Click it, select the simulator version and app, and click Go. It opens a Finder window to that app’s folder. Then, simply open the Library, Private Documents folder to find your database file.
You’ll need a SQLite-compatible database management tool. There are many. Personally, I use the sqlite-manager extension for Firefox. It works, though it has some quirks and will hang occasionally (forcing you to Force Close Firefox). Another limitation with that utility is that I can’t simply double-click the database file to open sqlite-manager.
Instead, with the extension open open, I click its open button. Then, I bring my Finder window forward and drag and drop the Private Documents folder onto the sqlite-manager’s open dialog box. That redirects it to the correct folder. You’ll have to select All Files from the Format drop down before you can select and open the database file. It sounds like a lot of steps, but once you get the hang of it you’ll perform them in no time.