3

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 exception '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?

Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421

1 Answers1

6

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.

Community
  • 1
  • 1
kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005