I'm working with Xcode 7 with swift on OSX 11.11 - and I've looked at a few tutorials that speak about debugging core data's SQL statements with a debug build flag. I've found this which gives me no additional info.
The flag is com.apple.CoreData.SQLDebug, this is how I've tried to enter it in the 'Edit Scheme' menu, in 'arguments passed on launch':
-com.apple.CoreData.SQLDebug 1
where I've tried both 1 and 3, I've also come across an old blog where the -
was switched with ~
which I also tried, but still no SQL is printed on the debug console.
I've confirmed that my CocoaAppCD.storedata file has items in it - any reason why it's not showing the sql statements?
According to this answer, a .storedata file is only generated if you are using NSXMLStoreType. Also NSXMLStoreType seems to be the default. If you are using an NSXMLStoreType, the SQLDebug flag has no effect as this only works for NSSQLiteStoreType.
You can use NSSQLiteStoreType by adding a persistent store of this type instead of the XML store to your NSPersistentStoreCoordinator (if your CoreData code is generated by Xcode, this will be in your AppDelegate):
do {
try coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil)
} catch { ...}