0
votes

I would like to know if is it possible to map jsons that aren't objects.

For example, I have WebService that are returning just simple values without a key:

[true] Or [1]

So, when restkit tries to parse this results crashes. For the first example, this the log:

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSCFBoolean 0x2f6ead8> valueForUndefinedKey:]: this class is not key value coding-compliant for the key result.'

The trouble that I have is that I can't modify the WebService.

1
Why you need restkit for that? You don't need to parse anything, just use a simple NURLRequest... - Javier Flores Font
Either don't use Restkit, or you should be using the HTTP status code to convey the success (and mapping to null). - Wain
@JavierFloresFont because, for example, I am calling a login WS if the login is sucessfull the WS returns the user data that I need to parse, but if the login data is wrong I just get a [0] - iVela

1 Answers

0
votes

Yes, it's possible, but they must have a key to them. Thats a bad JSON formatting. If you want to return a boolean in a JSON it should look like this:

{
    "IS_TRUE": 1
}