If you are using Core Data – or any ORM or persistence framework, for that matter – it’s often handy to be able to view the generated SQL for your queries. Fortunately, Core Data makes this incredibly easy, and unlike some other ORMs, it doesn’t require crazy hacks or third party tools.
Click your project’s name in the Xcode toolbar:
Select ‘Edit Scheme’:
Go to the ‘Arguments’ tab and click the + button under ‘Arguments passed on launch’:
Enter ‘-com.apple.CoreData.SQLDebug 1’ as the argument:
Press OK, and run your app.