Reading Stacktrace in Objective-C?
I don't like real-time debugging much, but if it's necessary I'll do it.
Is there any way to figure out what line of code a StackTrace in Objective-C refers to? What about the variable it refers to? For instance:
2010-05-13 19:39:11.673 Thingers[21003:207] *** -[NSCFString count]: unrecognized selector sent to instance 0x3b0ebb0
2010-05-13 19:39:11.674 Thingers[21003:207] *** Terminating app due to uncaught exc开发者_如何学JAVAeption 'NSInvalidArgumentException', reason: '*** -[NSCFString count]: unrecognized selector sent to instance 0x3b0ebb0'
2010-05-13 19:39:11.675 Thingers[21003:207] Stack: (
29303899
...
11130
)
I see that we're talking about sending a count
message to something that doesn't have it (maybe it's a NSCFString?), but is there any way to figure out what a/the named reference to that instance (0x3b0ebb0) refers to?
The stack here is mostly useless. What is important here is
-[NSCFString count]: unrecognized selector sent to instance 0x3b0ebb0
This means a -count
is sent to a string. This is usually caused by memory management bugs. You could enable NSZombie and run the program again to see what is being over-released.
Also, use Build → Build and Analyze in Xcode to find out possible memory management bugs in statically.
精彩评论