0

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.

4

2 回答 2

0

您需要检查该 getParametersHandler 的输出是 NSString 还是 NSDictionary..

要检查的代码

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

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

    }else{

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

    }

如果处理程序中没有值,则输出将是 NSString...

快乐的编码...

于 2013-10-02T11:10:00.990 回答
0

在您的代码中的某个地方,您正在调用lowercaseString认为是 a 的东西NSString,但实际上是 a NSDictionary。在您的代码中搜索此方法调用。可能发生的情况是,您正在对正在解析的数据结构做出某些假设,但这些假设并不总是正确的。

此外,您可以将代码直接发布到 StackOverflow 并保留格式。这比截屏图像要好得多,因为这意味着回答的人可以复制/粘贴。

于 2013-10-02T10:57:49.330 回答