Xcode查看CoreData SQL日志

Open "Product -> Scheme -> Edit Scheme..." in Xcode and add to "Arguments Passed on Launch":

-com.apple.CoreData.SQLDebug3

-com.apple.CoreData.SQLDebug3-com.apple.CoreData.Logging.stderr1

(The second launch argument is needed for Core Data debugging on iOS 10/macOS 10.12 or later, seecom.apple.CoreData.SQLDebug not workingfor more information.)

The you'll see all the values that the SQL statements are bound to. Example output:

test56[1588:c07]CoreData:sql:BEGINEXCLUSIVE

test56[1588:c07]CoreData:sql:INSERTINTOZEVENT(Z_PK,Z_ENT,Z_OPT,ZTIMESTAMP)VALUES(?,?,?,?)test56[1588:c07]CoreData:details:SQLite bind[0]=(int64)13test56[1588:c07]CoreData:details:SQLite bind[1]=(int64)1test56[1588:c07]CoreData:details:SQLite bind[2]=(int64)1test56[1588:c07]CoreData:details:SQLite bind[3]="368650709.435904"test56[1588:c07]CoreData:sql:COMMIT

你可能感兴趣的:(Xcode查看CoreData SQL日志)