调试 - [NSCFDictionary setObject:forKey:]:尝试插入nil值 [英] Debugging -[NSCFDictionary setObject:forKey:]: attempt to insert nil value
问题描述
我已经对我的项目做了一些更改,现在我运行应用程序时收到以上消息,而不是如何调试它。
我已阅读 这里 ,我必须在 - [NSCFDictionary setObject:forKey:]
中设置一个断点,并设置一个条件。
I have done some changes to my project and now I am getting above message when running the app and don't how how to debug it.
I have read here that I have to put a break point in -[NSCFDictionary setObject:forKey:]
and set a condition as well.
但是,我如何设置他们提到的条件? (仅当值为nil时停止)我在Xcode4上,并且只在尝试设置断点时获取此窗口。
But, how do I set the condition they mentioned? (Stop only when value is nil) I am on Xcode4 and only get this window when trying to set a breakpoint.
目前它停止在每个 - [NSCFDictionary setObject:forKey:]
这不是很有帮助,因为即使在正确的调用和苹果的内部调用也会停止(太多!)
Currently it stops at every -[NSCFDictionary setObject:forKey:]
which is not very helpful since it will stop even in correct calls and Apple's internal calls as well (too many!)
>
推荐答案
删除断点并添加异常断点。这将停止任何异常(如试图插入nil到字典)。对于所有调试会话,这是一个好的做法,即使是间歇性异常(这些难以找到的问题)将在调试器发生的时候被捕获。
Remove that breakpoint and add an Exception breakpoint. This will stop on any exception (like attempting to insert nil into a dictionary). It's good practice to leave this breakpoint on for all debugging sessions, that way even intermittent exceptions (those hard-to-find problems) will be caught in the debugger the moment they happen.
要添加异常断点,请单击断点列表底部的添加(+)按钮,然后单击添加异常断点。保持配置为原样。
To add an Exception breakpoint, click the Add (+) button at the bottom of the breakpoints list and click Add Exception Breakpoint. Leave it configured as-is.
这篇关于调试 - [NSCFDictionary setObject:forKey:]:尝试插入nil值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!