NSDictionary lowercaseString error

230 Views Asked by At

I'm working with an API generated with SudzC, I have a method which gets a response in XML and I'm trying to deserialize to an NSMutableDictionary.

This is the method to deserialize: enter image description here

And when I get the value of the Soap response I cast it and try to show the keys in the console log:

enter image description here

The problem is that I'm getting this error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM lowercaseString]: unrecognized selector sent to instance 0x7277680'


I have tried to do the same but deserializing to a NSMutableArray and it works, so the problem must be in the deserialize method but I can't find it.

2

There are 2 best solutions below

1
lxt On

Somewhere in your code you are calling lowercaseString on what you think is a NSString, but is in fact a NSDictionary. Search your code for this method call. What is probably happening is that you are making certain assumptions about the data structure you're parsing that aren't always correct.

Also, you can post code directly into StackOverflow and have the formatting be preserved. This is much better than screen-capturing images, as it means people answering can copy/paste.

0
mani murugan On

You need to check that output from that getParametersHandler is NSString or NSDictionary..

Code to check

 if ([resp isKindOfClass:[NSDictionary class]]) {

        //here you can do what you want to do..

    }else{

        //here you need to show the alert(No values)

    }

if there is no value in the handler, then output will be NSString...

Happy coding...