unrecognized selector sent to instance

2.7k views Asked by At

Possible Duplicate:
Unrecognized selector sent to instance

Can anyone tell me what is going on in this error code? Man apple is cryptic. I have just made a call via ObjectiveResource to data I know is fine.

-[NSDecimalNumber allKeys]: unrecognized selector sent to instance 0x5c671f0
2011-03-02 02:07:56.169 Mobile[13839:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSDecimalNumber allKeys]: unrecognized selector sent to instance 0x5c671f0'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x0133bbe9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x014905c2 objc_exception_throw + 47
    2   CoreFoundation                      0x0133d6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x012ad366 ___forwarding___ + 966
    4   CoreFoundation                      0x012acf22 _CF_forwarding_prep_0 + 50
    5   Mobile                      0x00013aa5 +[NSObject(JSONSerializableSupport) deserializeJSON:] + 832
    6   Mobile                      0x000138ad +[NSObject(JSONSerializableSupport) deserializeJSON:] + 328
    7   Mobile                      0x00012f0e +[NSObject(JSONSerializableSupport) fromJSONData:] + 161
    8   Mobile                      0x0000c8fa +[NSObject(ObjectiveResource) findAllRemoteWithResponse:] + 336
    9   Mobile                      0x0000c933 +[NSObject(ObjectiveResource) findAllRemote] + 43
    10  Mobile                      0x00004732 -[AllTableViewController refresh] + 103
3

There are 3 answers

0
Frank On

NSDecimalNumber does not support the method allKeys.

1
Ishu On

You calling allKeys method on NSDecimalNumber,and NSDecimalNumber can,t use this method thats why you having a crash.

allKeys method call with NSDictionary or NSMutableDictionary.

so type where after getting this log you get line number at there you need to edit the code.

1
Vladimir On

As others pointed NSDecimalNumber does not respond to allKeys selector and that causes a crash.

That may happen because the instance of NSDictionary, the intended message responder was prematurely deallocated for some reason (lack of retain?) and its address in memory got occupied by NSDecimalNumber instance that gets that wrong message.

So to fix that problem try locating the line that message and check if everything is ok with memory management in that code.