我得到了一個異常時,我嘗試使用下面的代碼把一個零對象放入NSDictionary:如何找出模擬器中的「調用堆棧」含義?
NSString * object = [self someMethod]; // the method return nil
NSDictionary * dict = @{ @"key": object };
這是一個簡單的錯誤,我知道,我只是用它作爲一個例子。在模擬器和在控制檯中的錯誤信息的應用程序崩潰低於:
2012-11-13 14:40:00.528 Ape[44456:11303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]'
*** First throw call stack:
(0x208b012 0x1a68e7e 0x2051a95 0x207e4e9 0x93f72 0x939b4 0x8800f 0x85f4d 0x852a3 0x1ce853f 0x1cfa014 0x1ce9fd6 0x1cfa014 0x1cf18b7 0x1ced405 0x1cea768 0x2031af5 0x2030#
libc++abi.dylib: terminate called throwing an exception
我的問題是如何在控制檯找出call stack
消息,並找出哪些行代碼導致該問題?
謝謝先進。