9

I was wondering if there is an option to log SQL queries in CoreData?

Borut Tomazin
  • 8,041
  • 11
  • 78
  • 91
  • possible duplicate of http://stackoverflow.com/questions/6428630/xcode4-and-core-data-how-to-enable-sql-debugging – Max MacLeod Jan 13 '12 at 14:26

2 Answers2

24

Yep, you may do that by putting -com.apple.CoreData.SQLDebug 1 to "Arguments Passed On Launch"

  • 4
    If anyone's wondering where you should set this, select Edit Scheme -> Run -> Arguments tab. – Isuru Aug 28 '14 at 11:46
0

I also found out that you can also get sql file out of your Documents folder. Open Terminal and paste this line in (replace values in slash-brackets with yours):

/Users/<YourUsername>/Library/Application Support/iPhone Simulator/<SimulatorVersion>/Applications/<AppID>/Documents/<SQLDBName>.sqlite

Just open file in your favorite SQL query browser.

Daniel Eggert
  • 6,665
  • 2
  • 25
  • 41
Borut Tomazin
  • 8,041
  • 11
  • 78
  • 91