我有同樣的問題,這個類,更糟糕的是服務器狀態碼實際上是200而不是304. mappingResult是空的以及實際的數據可以在操作中找到.HTTPRequestOperation.responseData作爲原始文章說。我正在運行0.20.0。請讓我知道是否有解決方法。
即使狀態碼爲200,以下顯示mappingResult爲空。響應數據太長而無法發佈。我也在使用RestKit的核心數據集成。
2013-04-25 16:38:14.244 MyApp[58584:c07] I restkit.network:RKHTTPRequestOperation.m:185 GET 'http://localhost:3000/api/search?access_token=3ad3b8c4a5fed9503a80c1f6afebab47&keywords=art' (200 OK) [0.0047 s]
(lldb) po mappingResult
$0 = 0x079a1880 <RKMappingResult: 0xac64c80, results={
"<null>" = (
);
}>
(lldb) po operation
$1 = 0x07995fd0 <RKManagedObjectRequestOperation: 0x7995fd0, state: Successful, isCancelled=NO, request: <NSMutableURLRequest http://localhost:3000/api/search?access_token=3ad3b8c4a5fed9503a80c1f6afebab47&keywords=art>, response: <NSHTTPURLResponse: 0x7e51fc0 statusCode=200 MIMEType=application/json length=58781>>
(lldb)
嗨加尼克,謝謝你的回答。實際上我發現我沒有添加pathPattern:對於每個響應描述符,如果使用CoreData,RestKit默認爲RKManagedObjectRequestOperation。一旦我爲每個響應對象指定了路徑模式,Restkit就可以區分並使用正確的RKObjectRequestOperation而不是RKManagedRequestOperation。我認爲這現在解決了我的問題。 – chourobin 2013-02-28 16:30:34
我嘗試了@glyuck提出的解決方案(子類化RKObjectManager並將cachePolicy設置爲NSURLRequestReloadIgnoringLocalAndRemoteCacheData)無濟於事。正如所見[本文](http://nshipster.com/nsurlcache/),「NSURLRequestReloadIgnoringLocalAndRemoteCacheData」尚未在「NSURLRequest」中實現。 **忍者編輯:**我的下一步是修改我的API服務,所以它永遠不會發送'304'標頭。 – rilla 2013-04-24 02:41:01