调试基础知识

时间:2015-04-14 09:15:10

标签: ios swift debugging xcode6

我是编程新手,我正试图在swift中编写我的第一个应用程序。 我的应用程序在运行时崩溃,但我无法理解Xcode调试导航器中的单词。 我无法发布截图,因为这是我在StackOverFlow的第一篇文章。

你能帮我解释一下XCode6(Swift)崩溃控制台吗? 我如何指出崩溃的原因? 我应该关注什么?

对于这个一般性问题很抱歉,但我无法在XCode 6中找到有关调试的明确文档。

感谢您的帮助

以下是控制台显示的内容(删除断点后):

  

(Entréedansla fonction,numberOfSectionsInTableView)(Entréedansla   fonction,tableView(:numberOfRowsInSection :))(Entréedansla   fonction,numberOfSectionsInTableView)(Entréedansla fonction,   tableView(:numberOfRowsInSection :))(Entréedansla fonction,   numberOfSectionsInTableView)(Entréedansla fonction,   tableView(:numberOfRowsInSection :))(Entréedansla fonction,   numberOfSectionsInTableView)(Entréedansla fonction,   tableView(:numberOfRowsInSection :))2015-04-14 12:05:12.659   ListeDeCourses [20984:2203737] - [ListeDeCourses.AjoutViewController   ButtonAdd:]:无法识别的选择器发送到实例0x7fe178739770   2015-04-14 12:05:12.663 ListeDeCourses [20984:2203737] *终止   应用程序由于未捕获的异常'NSInvalidArgumentException',原因:   ' - [ListeDeCourses.AjoutViewController ButtonAdd:]:无法识别   选择器发送到实例0x7fe178739770'   * 第一次抛出调用堆栈:(0 CoreFoundation 0x0000000106ecff35 exceptionPreprocess + 165 1 libobjc.A.dylib
  0x0000000108a13bb7 objc_exception_throw + 45 2 CoreFoundation
  0x0000000106ed704d - [NSObject(NSObject)doesNotRecognizeSelector:] +   205 3 CoreFoundation 0x0000000106e2f27c   ___转发_
+ 988 4 CoreFoundation 0x0000000106e2ee18 _CF_forwarding_prep_0 + 120 5 UIKit
  0x000000010775c8be - [UIApplication sendAction:to:from:forEvent:] + 75     6 UIKit 0x0000000107863410    - [UIControl _sendActionsForEvents:withEvent:] + 467 7 UIKit 0x00000001078627df - [UIControl touchesEnded:withEvent:] + 522 8
  UIKit 0x00000001077a2308 - [UIWindow   _sendTouchesForEvent:] + 735 9 UIKit 0x00000001077a2c33 - [UIWindow sendEvent:] + 683 10 UIKit
  0x000000010776f9b1 - [UIApplication sendEvent:] + 246 11 UIKit
  0x000000010777ca7d _UIApplicationHandleEventFromQueueEvent + 17370 12   UIKit 0x0000000107758103   _UIApplicationHandleEventQueue + 1961 13 CoreFoundation 0x0000000106e05551    CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 14 CoreFoundation 0x0000000106dfb41d   __CFRunLoopDoSources0 + 269 15 CoreFoundation 0x0000000106dfaa54 __CFRunLoopRun + 868 16 CoreFoundation
  0x0000000106dfa486 CFRunLoopRunSpecific + 470 17图形服务
  0x000000010afc69f0 GSEventRunModal + 161 18 UIKit
  0x000000010775b420 UIApplicationMain + 1282 19 ListeDeCourses
  0x0000000106ce243e top_level_code + 78 20 ListeDeCourses
  0x0000000106ce247a main + 42 21 libdyld.dylib
  0x00000001091ed145开始+ 1 22 ???   0x0000000000000001 0x0 + 1)libc ++ abi.dylib:终止于   NSException(lldb)

类型的未捕获异常

这是异常断点显示的内容:

  

(Entréedansla fonction,numberOfSectionsInTableView)(Entréedansla   fonction,tableView(:numberOfRowsInSection :))(Entréedansla   fonction,numberOfSectionsInTableView)(Entréedansla fonction,   tableView(:numberOfRowsInSection :))(Entréedansla fonction,   numberOfSectionsInTableView)(Entréedansla fonction,   tableView(:numberOfRowsInSection :))(Entréedansla fonction,   numberOfSectionsInTableView)(Entréedansla fonction,   tableView(:numberOfRowsInSection :))2015-04-14 12:10:28.285   ListeDeCourses [21044:2208020] - [ListeDeCourses.AjoutViewController   ButtonAdd:]:无法识别的选择器发送到实例0x7fcf5a748630   (LLDB)

最后一个屏幕截图: enter image description here

3 个答案:

答案 0 :(得分:1)

通常,当您使用Xcode调试应用程序时,如果应用程序崩溃,XCode将停在它崩溃的行。您可以看到" Debug导航器"

中发生了什么

enter image description here

控制台:

enter image description here

如果未出现控制台,请按此图像中蓝色按钮左侧的按钮进行显示。此栏按钮位于XCode的底部。

enter image description here

如果XCode没有在异常点停止,请尝试在断点菜单中添加异常断点:

enter image description here

答案 1 :(得分:0)

显示罪魁祸首
  

由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' - [ListeDeCourses.AjoutViewController ButtonAdd:]:无法识别的选择器发送到实例0x7fe178739770

表示您向控制器发送未知消息ButtonAdd:。设置断点后,您的代码将停在相关位置,您应该能够找到原因。

答案 2 :(得分:0)

我终于在StackOverFlow中发现我需要取消选中一个选项:Debug>调试>始终显示拆卸。 感谢所有帮助我在搜索中找到好的关键字。

相关问题