Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mikezang

macrumors 6502a
Original poster
May 22, 2010
854
7
Tokyo, Japan
When I run my app, I got error as below, how and where can I find the reason for this error? please give some suggestion.
Code:
-[__NSDictionaryM urlEncodedString]: unrecognized selector sent to instance 0x9aa43d0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM urlEncodedString]: unrecognized selector sent to instance 0x9aa43d0'
*** First throw call stack:
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,557
6,058
Look for someplace where you're trying to use a method called urlEncodedString. My guess is you want to call it for an object in a dictionary or array that you think responds to it but it's actually a dictionary.

Don't you have a call stack you can look at to find the methods you called?
 

mikezang

macrumors 6502a
Original poster
May 22, 2010
854
7
Tokyo, Japan
Look for someplace where you're trying to use a method called urlEncodedString. My guess is you want to call it for an object in a dictionary or array that you think responds to it but it's actually a dictionary.

Don't you have a call stack you can look at to find the methods you called?
Thanks for your message. only main in call stacks. But I got a way to trace base on How do I find out what object is "instance 0xfc78f70"

add an Exception breakpoint.
 

Duncan C

macrumors 6502a
Jan 21, 2008
853
0
Northern Virginia
Thanks for your message. only main in call stacks. But I got a way to trace base on How do I find out what object is "instance 0xfc78f70"

add an Exception breakpoint.

Right. You want to add an exception breakpoint, for all exceptions thrown from Objective-C (Some system frameworks that are written in C++ throw and catch exceptions internally, and those will cause problems. The security framework in particular gave me fits until I set my exception breakpoint to Objective-C only.

Once you've done that, right-click on the breakpoint in the breakpoints list and select copy to>user. That makes the breakpoint get added to all your projects.

As far as your error, messages that are sent to objects that they shouldn't is usually as sign of an over-release bug (a.k.a. "zombies".) Learn how to use the zombies instrument in instruments to find such bugs.

Alternately you can enable zombies in your debug scheme. Check out this article titled Running Your Application with Diagnostics

You might also try selecting analyze from the product menu to do static analysis on your code. That often finds memory management problems like over-releases and leaks.
 

mikezang

macrumors 6502a
Original poster
May 22, 2010
854
7
Tokyo, Japan
Right. You want to add an exception breakpoint, for all exceptions thrown from Objective-C (Some system frameworks that are written in C++ throw and catch exceptions internally, and those will cause problems. The security framework in particular gave me fits until I set my exception breakpoint to Objective-C only.

Once you've done that, right-click on the breakpoint in the breakpoints list and select copy to>user. That makes the breakpoint get added to all your projects.

As far as your error, messages that are sent to objects that they shouldn't is usually as sign of an over-release bug (a.k.a. "zombies".) Learn how to use the zombies instrument in instruments to find such bugs.

Alternately you can enable zombies in your debug scheme. Check out this article titled Running Your Application with Diagnostics

You might also try selecting analyze from the product menu to do static analysis on your code. That often finds memory management problems like over-releases and leaks.
Thanks for you advise.
This exception is happened in a library .a file, so I am not sure how to solve it, do you have any idea?
 

Duncan C

macrumors 6502a
Jan 21, 2008
853
0
Northern Virginia
Thanks for you advise.
This exception is happened in a library .a file, so I am not sure how to solve it, do you have any idea?

If you pass an object to a library function that has been autoreleased too many times, you can get that behavior.

Run analyze and zombies on your app as I suggested.
 

mikezang

macrumors 6502a
Original poster
May 22, 2010
854
7
Tokyo, Japan
If you pass an object to a library function that has been autoreleased too many times, you can get that behavior.

Run analyze and zombies on your app as I suggested.
I found the reason for this exception as below
Code:
To use the SDK in your app, the -ObjC value needs 
to be added to the "Other Linker Flags" setting 
in your Xcode project. See this article for more details: 
Apple Technical Q&A QA1490"
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.