BOOL设置不正确,调试输出令人困惑 [英] BOOL not setting correctly, debug output is confusing

查看:101
本文介绍了BOOL设置不正确,调试输出令人困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Xcode中设置BOOL,出于某种原因,它显然是拒绝工作的.没有其他设置此布尔值,仅此一个实例.我的代码如下:

I am trying to set a BOOL within Xcode and for some reason it is plain refusing to work. Nothing else is setting this bool, just this one instance. My code is below:

.h

@interface SuspectsViewController : UIViewController 
{
    BOOL boolContentChanged;
}

@property (nonatomic) BOOL boolContentChanged;

.m

@synthesize boolContentChanged;

-(IBAction)buttonPressed:(id)sender
{
    boolContentChanged = true;
}

我也尝试过使用self.boolContentChanged,但是也没有任何反应.为了尝试调试此问题,我使用了po boolContentChanged并获取以下输出,第一个po在boolContentChanged = true之前,第二个在poolContentChanged = true之前.

I have also tried using self.boolContentChanged but nothing happens either. To try and debug this I used po boolContentChanged and get the following output, the first po is before boolContentChanged = true and the second is after.

(lldb) po boolContentChanged
(BOOL) $4 = '\0' <nil>
(lldb) po boolContentChanged
(BOOL) $7 = '\0' <nil>

$是表示它指向某个地址,还是纯粹用于调试参考?

Does the $ indicate that it's pointing to a certain address, or is that purely for debugging reference?

还有,这有什么理由吗?当然,如果它是布尔值而不是指针,则不需要隐式设置吗?

Also, is there any reason this would be nil? Surely it doesn't need implicitly setting if it is a bool and not a pointer?

由于我无法解决任何对此的建议, 提前致谢, 埃利奥特

Any advice on this is much appreciated as I can't work it out, Thanks in advanced, Elliott

推荐答案

我终于设法弄清了正在发生的事情.关于调试器,确实使用YES/NO而不是true/false做出了实际的改变,如果我使用p来显式找到它们,则仍会设置这些值,但是当使用YES/NO时,它们会自动显示.因此,在某些情况下似乎无法再次更新智能感知.

I finally managed to figure out what was happening. In regards to the debugger it did make a practical difference using YES / NO as opposed to true / false, the values were still being set if I used p to explicitly find them, but when using YES / NO they would show automatically. So once again it seems to be the intellisense that is failing to update in certain situations.

感谢大家的帮助.

这篇关于BOOL设置不正确,调试输出令人困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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