objective-c - 数据库错误 : use of undeclared identifier

标签 objective-c ios xcode lldb

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

@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 block 中声明的数据字段;您似乎在 @implementation 中定义字段。

试着把它放在标题中,例如

@interface Test
{
    NSData *_data;
}
. . .
@end

关于objective-c - 数据库错误 : use of undeclared identifier,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11488361/

相关文章:

ios - 使用 LBYouTube 在 UIView 中打开 YouTube 视频

objective-c - 使用 NSXMLParser delegate 解析两个文件

ios 新的应用程序版本更新会影响旧版本中存储在 userdefault 中的数据吗?

objective-c - Core-Plot 中 y 轴标签的四舍五入数字

android - Splash 流到 Container/FlatButton 之外 - Flutter

ios - 从节点滑动时的 RemoveAction

c++ - iOS - Xcode - OpenCV - findContours 错误

ios - 无效的 bundle - App Store 拒绝

c - 如何在 Xcode 上运行现有的 C 文件

iphone - 执行错误访问问题