How to print an object property in the debugger console in Xcode?

I have an object that was created with a Core Data code generator:

.h file:

@interface MyObject :  NSManagedObject  
{
}

@property (nonatomic, retain) NSString * title;
@end

.m file:

@implementation MyObject
@dynamic title;
@end

I set a breakpoint, and now I want to print the property of titleone of my instances ( myObject) on the console.


When I try po myObject.title, I get an error:

No name with name.

When I try po [myObject title], I get an error:

The target does not respond to this message selector.

When I try myObject.titlein the "Expressions" window, I get an error message:

out of sight

... although myObjectin the same window it allows me to see some of its members.


How to print an object property in a console window and / or expression in Xcode?

+5
source share
1

, valueForKey -

po [myObject valueForKey:@"title"]

, .

+14

All Articles