使用RestKit使用POST请求图像

时间:2013-09-05 17:43:32

标签: iphone ios restkit restkit-0.20

我正在尝试使用POST请求从服务器接收图像。我试图使用RestKit获取图像。我添加了用于创建请求的请求描述符,它工作正常。但是,我不明白如何使用对象管理器映射图像,因为返回的内容不再是JSON。

这是我得到的错误

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 个答案:

答案 0 :(得分:0)

你不应该使用RestKit。 RestKit用于映射来自JSON / XML / ...的对象。它不用于接收图像数据。相反,使用RestKit附带的AFNetworking(内部用于所有通信),可以更好地处理简单的帖子和图像响应。

如果您需要执行一些对象序列化来创建JSON来完成帖子,那么请查看使用RKSerializationRKMapperOperation

相关问题