How to read Xcode console output?

2

As a Java and PHP developer new to Xcode, I am having trouble dealing with memory errors. I have a sample program from a book, which crashes on startup with "Program received signal 'SIGABRT'." I don't know what to do with the console output below. I realize it's some kind of stack trace, but the name on the left is just the name of the application, not a class or file. I don't know what "main + 121" or "start + 53" means or where to look. Any guidance would be appreciated.

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)
iphone
objective-c
xcode
console
asked on Stack Overflow May 11, 2011 by BobH • edited May 11, 2011 by mmmmmm

3 Answers

4

On the right are the methods that were called that are on the stack. I generally just look for anything that is from one of my methods (though this won't always work) and then it'll give you the method call that the problem originated from. in the trace at call number 3 on "FlowerInfoNavigator" the method tableView:didSelectRowAtIndexPath: was called and somewhere in there is what caused the crash. You should be able to use the debugger and breakpoints to narrow it down from there hopefully. Good luck.

Edit: as I relooked at your error message: at the top of it it gives you the error. You tried to retrieve an object from a NSDictionary that wasn't initialized yet, and from above, it occurred in your didSelectRowAtIndexPath method

answered on Stack Overflow May 11, 2011 by Jesse Naugher
0

The console wouldn't be the only place you look. Take a look at your Debugger too. Over there there is usually one line that is bolded. If you tap that it'll show you exactly where the crash happened.

Looks like you didn't init your NSDictionary

answered on Stack Overflow May 11, 2011 by shabbirv
0

The Crash is due to nsdictionary is not initialized yet and how to search for during a crash ,first look at console so you will get idea about what caused the crash or exception and to get where the application crashed you can check out debugger .In the debugger the the particlar line will be in bold where the application crashed.

Apart from you can also use NSZombieEnabled (BOOL) to get what is causing the application crash .More about NSZombieEnabled can be found here http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/130-Debugging_Applications/debugging_applications.html

Note : here do make sure to make NSZombieEnabled set to NO at time of processing the application to submission to apple store.

Hope this helps.

answered on Stack Overflow May 11, 2011 by mrugen

User contributions licensed under CC BY-SA 3.0