我正在使用xCode for iPhone中的一个项目,我收到一个EXC_BAD_ACCESS错误,但是,我只是在单步执行我想要调试的函数时收到错误.当我关闭函数断点,但仍然在调试模式下运行项目时,我从未收到此错误.无论如何要解决这个问题或找出导致EXC_BAD_ACCESS错误的原因.
该错误出现在线上: for ( BEUCharacterAIBehavior *behavior in behavior_.behaviors )
但是,当单步执行值behavior_.behaviors时,会分配并保留.NSZombiesEnabled已设置但仍然收到神秘的错误消息.
码:
-(BEUCharacterAIBehavior *)getHighestValueBehaviorFromBehavior:(BEUCharacterAIBehavior *)behavior_ {
//if the behavior is a leaf then stop checking because there are no sub behaviors
if([behavior_ isLeaf]) return behavior_;
//temp variable for highest value behavior so far
BEUCharacterAIBehavior *highest = nil;
//NSLog(@"BEHAVIORS:%@",behavior_.behaviors);
for ( BEUCharacterAIBehavior *behavior in behavior_.behaviors )
{
//if there is a highest value behavior check if the highest value behavior has a larger value than the new one
if(highest)
{ …Run Code Online (Sandbox Code Playgroud)