Wednesday, 4 September 2013

RestKit 0.2x Routes with Parameters

RestKit 0.2x Routes with Parameters

I've setup the following route....
[objectManager.router.routeSet addRoute:[RKRoute routeWithClass:[Pool
class] pathPattern:@"Pool/:name?password=:password"
method:RKRequestMethodGET]];
Notice the parameter I'm passing (password for the Pool object that the
needs to confirm both the name of the pool and the password).
I then make the call to get the Pool...
[[RKObjectManager sharedManager] getObjectsAtPath:[NSString
stringWithFormat:@"Pool/%@?password=%@", poolName, password]
parameters:nil success:^(RKObjectRequestOperation *operation,
RKMappingResult *mappingResult)
However it doesn't seem to route. I've tried adding password in the
parameters field but that doesn't work either.
Does routing not allow for parameters?
The errors I'm getting is "Mapping HTTP response to nil target object..."
and "The representation inputted to the mapper was found to contain nested
object representations at the following key paths: Pool This likely
indicates that you have misconfigured the key paths for your mappings..."
I think that last one is the key one. I'm not sure I understand the error.
I have no nested objects in the Pool object. Just 4 NSStrings and an
NSNumber.
Any ideas?

No comments:

Post a Comment