I am doing a multi-part posting of image data and some values using RestKit's RKClient like so:
RKParams* params = [RKParams params];
[params setValue:foo.accountId forParam:@"accountId"];
[params setValue:foo.identifier forParam:@"fooId"];
[params setValue:_photoId forParam:@"photoId"];
[params setData:data MIMEType:@"image/png" forParam:@"image"];
[[RKClient sharedClient] post:@"/foo/uploadPhoto" params:params delegate:self];
This works great, and my backend server responds with JSON representation of the server side model object, it look like this:
{"id":"4ee2b4670364720c089e75b9","accountId":"4ebee3469ae2d8adf983c561","fooId":"4ec0983d036463d900841f0b","photoId":"E5B20AF1-9F10-4175-8262-852BDA3DEDE9","filename":"4ebee3469ae2d8adf983c561_4ec0983d036463d900841f0b_E5B20AF1-9F10-4175-8262-852BDA3DEDE9","contentType":"image/png"}
What I need to do now is map this to my client side (iOS) model object. The client side model object is almost the same, but not identical (so using RKJSONParser's objectFromString method is not an option), therefore I have a custom RKObjectMapping defined that handles the mapping. RKClient's delegate only gets a RKResponse, so how can I use the response along with the mapper to get an instance of my client side model object?
Note: To be clear, I am very familiar how this works when using RKObjectManager to post an object and map a response. The unique part of my situation is that I am using RKClient to achieve the multi-part post. Unfortunately RKClient doesn't seem to have simple methods available to handle response mapping like RKObjectManager does... unless I am missing something (which I hope and am and you all will point out for me ;).