问题
Anyone know whats going on here:
@implementation Test
{
NSData *_data;
}
- (id)initWithData:(NSData *)data
{
self = [super init];
if (self)
{
_data = data;
}
return self; // BREAKPOINT HERE
}
From lldb:
(lldb) p data
(NSData *) $1 = 0x07f911e0 30308 bytes
(lldb) p _data
error: use of undeclared identifier '_data'
error: 1 errors parsing expression
Why can't I view _data
?
回答1:
I've only ever seen data fields declared in an @interface
block; you appear to be defining fields in the @implementation
.
Try putting this in the header instead, e.g.
@interface Test
{
NSData *_data;
}
. . .
@end
来源:https://stackoverflow.com/questions/11488361/lldb-error-use-of-undeclared-identifier