lldb错误:使用未声明的标识符 [英] lldb error: use of undeclared identifier

查看:270
本文介绍了lldb错误:使用未声明的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道这里发生了什么事

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
}

来自lldb:

(lldb) p data
(NSData *) $1 = 0x07f911e0 30308 bytes
(lldb) p _data
error: use of undeclared identifier '_data'
error: 1 errors parsing expression

为什么我不能查看_data?

推荐答案

我只见过在@interface块中声明的数据字段;您似乎正在定义@implementation中的字段.

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

这篇关于lldb错误:使用未声明的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆