Where to find error for [__NSDictionaryM urlEncodedString]

Discussion in 'iOS Programming' started by mikezang, Dec 5, 2012.

  1. mikezang macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
    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:
    
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    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?
     
  3. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #3
    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.
     
  4. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #4
    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.
     
  5. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #5
    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?
     
  6. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #6
    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.
     
  7. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #7
    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"
    
     

Share This Page