IOS: how to watch NSManagedObject attributes during debugging

As the name says, I want to debug some Core Data errors. Instead of using NSLog everywhere in the code, is it possible to view entity attributes in the Xcode 4 viewport? As a quick view tool in Entity Framework 4.0.NET.

+8
ios core-data watch
source share
1 answer

Any value that has a named variable assigned to it can be viewed in the debugger. In Xcode 4, it appears in the left column of the debugger. If you select a variable, you can use the Print to Console shortcut menu option to get a detailed description printed on the debugger console. This is useful when checking managed objects, because they often contain more information than a list of variables that can be easily displayed.

(See Xcode 4 Transition Guide: Running Control Programs in the Debugging Area and Source Editor, Figure 5-9

Alternatively, you can issue any of the standard gdb commands from the command line in the debugger console. The most useful of these commands is po , which stands for print object . Say you have a myObject that has aProperty property. You can study it directly using:

 po [myObject valueForKey:@"aProperty"] 

If you subclass NSManagedObject, you also have the option to override the description method, which allows you to create custom descriptions of the object that will be displayed in print to console and the po command.

+19
source share

All Articles