2013-07-23 112 views
40

如何在Xcode中添加异常断点?Xcode中的异常断点

int main(int argc, char *argv[]) { 

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 
    int retVal = UIApplicationMain(argc, argv, nil, @"AppController"); 
    [pool release]; 
    return retVal; 
} 

我的项目在下面的代码中随机崩溃,在谷歌搜索和一些人建议添加异常断点。我通过点击源代码行添加了断点。编辑断点不允许我改变类型。如何添加异常断点和添加位置? ?(在AppDelegate中

enter image description here

+1

它不会在给定的代码中崩溃。 – rptwsthi

+1

@rptwsthi,在添加异常断点后xcode我得到确切的崩溃线。它的伟大..为什么不默认启用这个在调试模式... :) – iPhoneChip

+0

@iPhoneChip:可能是因为它只是停在那里,并没有提供有关例外的信息。 – Rakesh

回答

62

您可以在Xcode中轻松添加异常断点见下图:。

enter image description here

22

下面是步骤

  • 移动到“ Breakpoint Navigator“

  • 点击导航器左下角的+符号。

​​

  • 你应该看到这一点。

enter image description here

18

遵循以下步骤:

  • 在xcode的去断点导航(按命令+ 6 /对于xcode7 +命令+ 7)
  • 点击+在底部按钮左
  • 点击添加异常断点,按照下图中的说明

enter image description here