0
votes

I am trying to receive an image from a server using a POST request. I am trying to get the image using RestKit. I have added the request descriptors for creating the request and it works fine. But, I don't understand how to map the image with the object manager as the returned content is not a JSON anymore.

Here is the error that I am getting

Error Domain=org.restkit.RestKit.ErrorDomain Code=1001 "No mappable object representations were found at the key paths searched." UserInfo=0x9b7a870 {DetailedErrors=(
), NSLocalizedFailureReason=The mapping operation was unable to find any nested object     representations at the key paths searched: promotion
The representation inputted to the mapper was found to contain nested object representations at the following key paths: message, status
This likely indicates that you have misconfigured the key paths for your mappings., NSLocalizedDescription=No mappable object representations were found at the key paths searched., keyPath=null}
1
You post an object and get an image back? - Wain
Yes, I am trying to post an object and get an image back. - Pulkit Goyal

1 Answers

0
votes

You should not use RestKit for this. RestKit is meant to be used for mapping objects from JSON / XML / ... It is not meant for receiving image data. Instead, use AFNetworking which is included with RestKit (used internally for all comms) and can much better handle a simple post and image response.

If you need to do some object serialisation to create the JSON to do your post then look at using RKSerialization and RKMapperOperation.