views:

220

answers:

3

I send some data from my App to a web service and it replies. I start that process by clicking a button in the UI. It works fine, until I start trying to do that really fast. If I do that fast it breaks and I get this message:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[_NSXMLParserInfo length]: unrecognized selector sent to instance 0x3534a60'

I'm not sure what "unrecognized selector" means there though? I could handle the exception and forget about it but I wonder if there is something deeper going on here?

Any help appreciated // :)

+2  A: 

It means that the NSXMLParserInfo does not have a function called "length". A selector is another word for method/function in Objective-C.

I'm not sure what clicking fast has to do with it, though. Perhaps an event handler takes a bit of time but clicking fast causes it to get fired again while it's still working?

Benjamin Cox
Thanks, although I can't figure what my code is doing in this case as I never call length with the object noted above?
Spanky
Sorry for the delayed response. I'll just second nall's suggestion from another answer - take a look at http://stackoverflow.com/questions/1163981/how-to-add-a-breakpoint-to-objcexceptionthrow Once you have that breakpoint set you can see all of the method calls leading up to the call that broke. Some code of yours should be in there somewhere - click on that line and it'll take you to the line on which you make that call.
Benjamin Cox
Thanks, this helped :)
Spanky
+1  A: 

It means you sent an object a message it doesn't respond to, probably because you're assuming it's a different type than it actually is.

Azeem.Butt
The second piece to NSD's answer is that this isn't the kind of exception you want to catch and "handle". This is a bug.
nall
+2  A: 

This almost certainly indicates a memory management bug. An NSString is getting released prematurely and this _NSXMLParserInfo object is getting allocated in its place. Try doing it with NSZombieEnabled and you should get a zombie exception instead.

Chuck
Upon what is this certainty of yours based?
Azeem.Butt
It's based on experience.
Chuck
And check out this answer as you likely want to get this into the debugger: http://stackoverflow.com/questions/1163981/how-to-add-a-breakpoint-to-objcexceptionthrow
nall