iphone - 如何读取 Xcode 控制台输出?

标签 iphone objective-c xcode console

作为一名刚接触 Xcode 的 Java 和 PHP 开发人员,我在处理内存错误时遇到了麻烦。我有一本书中的示例程序,该程序在启动时崩溃,并显示“程序收到信号‘SIGABRT’”。我不知道如何处理下面的控制台输出。我意识到这是某种堆栈跟踪,但左侧的名称只是应用程序的名称,而不是类或文件。我不知道“main + 121”或“start + 53”是什么意思或在哪里查找。任何指导将不胜感激。

2011-05-11 10:43:23.071 FlowerInfoNavigator[22537:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary objectForKey:]: method sent to an uninitialized mutable dictionary object'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00dc25a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00f16313 objc_exception_throw + 44
    2   CoreFoundation                      0x00dbf542 -[__NSPlaceholderDictionary objectForKey:] + 194
    3   FlowerInfoNavigator                 0x0000289a -[RootViewController tableView:didSelectRowAtIndexPath:] + 330
    4   UIKit                               0x0008bb68 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
    5   UIKit                               0x00081b05 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 219
    6   Foundation                          0x0079b79e __NSFireDelayedPerform + 441
    7   CoreFoundation                      0x00da38c3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
    8   CoreFoundation                      0x00da4e74 __CFRunLoopDoTimer + 1220
    9   CoreFoundation                      0x00d012c9 __CFRunLoopRun + 1817
    10  CoreFoundation                      0x00d00840 CFRunLoopRunSpecific + 208
    11  CoreFoundation                      0x00d00761 CFRunLoopRunInMode + 97
    12  GraphicsServices                    0x00ffa1c4 GSEventRunModal + 217
    13  GraphicsServices                    0x00ffa289 GSEventRun + 115
    14  UIKit                               0x00022c93 UIApplicationMain + 1160
    15  FlowerInfoNavigator                 0x00001b99 main + 121
    16  FlowerInfoNavigator                 0x00001b15 start + 53
)
terminate called after throwing an instance of 'NSException'
(gdb)

最佳答案

右侧是堆栈上调用的方法。我通常只是查找来 self 的方法之一的任何内容(尽管这并不总是有效),然后它会给您提供问题根源的方法调用。在“FlowerInfoNavigator”上的调用号 3 处的跟踪中,调用了方法 tableView:didSelectRowAtIndexPath: ,其中的某个位置导致了崩溃。您应该能够使用调试器和断点来缩小范围。祝你好运。

编辑:当我重新查看您的错误消息时:它在顶部给出了错误。您尝试从尚未初始化的 NSDictionary 检索对象,从上面看,它发生在您的 didSelectRowAtIndexPath 方法

关于iphone - 如何读取 Xcode 控制台输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5968490/

相关文章:

iphone - 我还能从这份崩溃报告中获得哪些其他信息?

iphone - PayPal 如何将 UI 元素和图像资源整合到 iPhone 静态库中?

ios - 如何相互访问我自己的 2 个 iOS 应用程序数据库

ios - 使用segue传递图像时指针类型不兼容? objective-c Xcode

objective-c - BaseSDK从10.5改为10.6后出现字体粗细问题

iPhone - 键盘角按钮

iphone - 如何使用 UITextView 在 iPhone 的 Objective-C 中保存/加载文本文件?

objective-c - NSArray 循环问题

ios - TableView Controller 代码未被调用

ios - Xcodebuild 不生成具有 x86_64 架构的动态框架