简体   繁体   English

带有LLDB的Xcode 4.3中的奇怪错误消息

[英]Weird error message in Xcode 4.3 with LLDB

I am currently writing an iOS app with Xcode 4.3.2. 我目前正在使用Xcode 4.3.2编写iOS应用程序。 In most parts of my code, debugging with LLDB works just fine. 在我的代码的大多数部分中,使用LLDB进行调试工作正常。 However at some point I am getting a strange message while stepping through my code. 但是在某些时候,我在逐步执行代码时收到了一条奇怪的消息。 When I hover over an iVar, it says 当我将鼠标悬停在iVar上时,它说

Error [IRForTarget]: Couldn't find Objective-C indirect ivar symbol OBJC_IVAR_$_MyFancyClass.iVar 错误[IRForTarget]:找不到Objective-C间接ivar符号OBJC_IVAR _ $ _ MyFancyClass.iVar

instead of showing me the value. 而不是向我展示价值。 However, in the Variables View , I can see it just fine. 但是,在Variables View ,我可以看到它很好。 Until I'm selecting Print Description of ... that is, because then, Xcode crashes... When I use GDB, the hovering works but the type and values of the variable are wrong. 直到我选择...的Print Description of ... ,因为那时,Xcode崩溃......当我使用GDB时,悬停工作,但变量的类型和值是错误的。

I recon that there is something wrong with my code which in turn causes the debuggers to fail. 我认为我的代码有问题,这反过来导致调试器失败。 However, the code runs fine. 但是,代码运行正常。 I'd love to provide some samplecode but the class is rather long and I can't pinpoint the exact location of my screwup. 我很乐意提供一些样本代码,但课程相当长,而且我无法确定我的搞砸的确切位置。 So has anybody encountered a similar behavior? 那么有没有人遇到类似的行为?

UPDATE: Actually, it seems as if this happens everywhere in my code, not just in some specific files. 更新:实际上,似乎这在我的代码中到处发生,而不仅仅是在某些特定文件中。 If it helps, while LLDB show the above message, GDB always shows an object of the Class that is owning the iVar, instead of the iVar itself. 如果它有帮助,当LLDB显示上述消息时,GDB总是显示拥有iVar的Class的对象,而不是iVar本身。 It looks as if there is something wrong with the memory management. 看起来内存管理有问题。 For example, if I say something like 例如,如果我说的话

[notificationCenter addObserver:self selector:@selector(foo) name:bar object:objA];

the selector is invoked even when I have 即使我有选择器也会被调用

[notificationCenter postNotificationName:bar object:objB];

The cause of this error are incorrect build settings, as indicated by the discussion in the question post comments. 此错误的原因是错误的构建设置,如问题发表评论中的讨论所示。 This can be fixed by setting "Deployment Postprocessing" back to NO for Debug-Mode (the default value). 这可以通过将“部署后处理”设置回调试模式的NO(默认值)来修复。

确保将MyFancyClass.m添加到目标

Your selector that the nsnotification is being sent to needs to have one (and only one) argument, which is an NSNotification. 您发送nsnotification的选择器需要有一个(且只有一个)参数,这是一个NSNotification。 So when you do this: 所以当你这样做时:

[notificationCenter addObserver:self selector:@selector(foo) name:bar object:objA];

-(void)foo
{

}

...you need to be doing this: [notificationCenter addObserver:self selector:@selector(foo:) name:bar object:objA]; ...你需要这样做:[notificationCenter addObserver:self selector:@selector(foo :) name:bar object:objA];

-(void)foo:(NSNotification *)notification
{

}

Notice the colon in the selector for the notificationCenter, and the argument for foo. 注意notificationCenter选择器中的冒号和foo的参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM