0

I am getting crash with following addresses and message in XCode console. Although I understand crash is because of passing somewhere nil value in NSDictionary. But if you just look into logs, its hard to track which class and method resulted in this crash.

Is there a way to track back crash addresses into Class name and method name?

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[5] First throw call stack: (0x181092db0 0x1806f7f80 0x180f7b77c 0x180f7b614 0x1001578d8 0x100157334 0x187dec8b8 0x187de8aac 0x187de2e48 0x181048f84 0x1810488bc 0x181046d04 0x180f70c50 0x182858088 0x18625a088 0x10027b718 0x180b0e8b8) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

Meet Doshi
  • 4,241
  • 10
  • 40
  • 81
Adeesh Jain
  • 645
  • 10
  • 22
  • http://stackoverflow.com/questions/37998489/how-to-get-line-number-method-name-and-class-name-when-crash-occurs-using-obje – Teja Nandamuri Jul 18 '16 at 19:29
  • 1
    you can ge the crashed method name and class butyou cannot get the exact line of crash. IF you have enabled the exception breakpoint, it might highlight the crash line for some crashes.You can use crashlytics framework. – Teja Nandamuri Jul 18 '16 at 19:31
  • Add an exception break point and run your app :) http://blog.manbolo.com/2012/01/23/xcode-tips-1-break-on-exceptions – sloik Jul 18 '16 at 19:57

1 Answers1

0

As referenced from: How to get line number, method name, and class name when crash occurs using Objective C

Below piece of code good information about tracking exception method and class:

In my app delegate's didFinishLaunchingWithOptions method I had made my own exception handler:

NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);

-- uncaughtExceptionHandler method implementation --

void uncaughtExceptionHandler(NSException *exception) {
NSLog(@"CRASH: %@", exception);
NSLog(@"callStackSymbols: %@", [exception callStackSymbols]);
NSLog(@"callStackReturnAddresses: %@", [exception callStackReturnAddresses]);
NSLog(@"reason: %@", [exception reason]);
NSLog(@"name: %@", [exception name]);    
NSLog(@"%s %d %s %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, __FUNCTION__);

// Internal error reporting }

Community
  • 1
  • 1
Adeesh Jain
  • 645
  • 10
  • 22