Debugging Core Data
This blog post is just a short overview of the tools that I am using when working with Core Data.
To enable launch arguments for your app select your target from the Xcode toolbar and select
You’ll see this menu:
Any argument passed on launch will override the current value in
NSUserDefaults for the duration of execution.1
Here are some options if you’re using SQLite as your persistent store:
This option allows you too see actual SQL statements sent to the persistent store used by Core Data. Verbosity of the output can be controlled by setting the value from 1 to 3. Higher the number more SQL output you’ll see.
With this option you can turn on the syntax coloring.
Control the way in which data in a SQLite-based store is written to disk. With 0 disk switching is switched off. 1 means normal and 2 is the default.
With this option SQLite store does extra integrity checking if set to 1.
This option enables assertions to enforce Core Data’s multi-threading policy. Higher value enables more debugging.
There are many tools available for viewing actual SQLite that is stored in application’s Documents directory.
In the simulator
.sqlite is located at:
~/Library/Application Support/iPhone Simulator/X/Applications/XXXX-XXXX-XXXX-XXXX/Documents where
X is your deployment target.
To simplify the process you can download app called SimPholders. It is a small utility for fast access to your iPhone Simulator apps. Or you can use awesome debugging toolkit called PonyDebugger.