2013-09-05 70 views
0

我試圖從服務器接收使用POST請求的圖像。我正在嘗試使用RestKit獲取圖像。我添加了用於創建請求的請求描述符,它工作正常。但是,我不明白如何映射圖像與對象管理器,因爲返回的內容不再是JSON。使用RestKit POST請求圖像

這裏是我得到

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} 
+0

您發佈一個對象並獲取圖像嗎? – Wain

+0

是的,我試圖發佈一個對象並獲取圖像。 –

回答

0

你不應該使用RestKit此錯誤。 RestKit旨在用於從JSON/XML/...映射對象...它並不意味着接收圖像數據。相反,使用包含在RestKit中的AFNetworking(用於所有通信的內部),並且可以更好地處理簡單的帖子和圖像響應。

如果你需要做一些對象序列化來創建JSON來做你的文章,然後看看使用RKSerializationRKMapperOperation