0

I am contacting a REST service that does not always conform to KVC with RestKit. The response I'm having trouble with is simple:

true

I do not need this value mapped to a class, but this is the class I have set up to receive this value:

@interface BooleanResponse : NSObject
@property (nonatomic) BOOL response;
@end

I have already handled top-level arrays, so I attempted the same mapping:

RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[BooleanResponse class]];
[mapping addPropertyMapping:[RKAttributeMapping attributeMappingFromKeyPath:nil toKeyPath:@"response"]];

Upon completion, RestKit prints the error: Loaded an unprocessable response (200) with content type 'application/json'

Interestingly, JSONLint says that true is invalid JSON--but a single boolean response makes sense for this request. (Aside from it being an unnamed value, although as I mentioned KVC is not followed.)

I did not implement the service. Can I make RestKit handle solitary values, or am I stuck handling them as special cases?

4

0 回答 0