我已經將RestKit安裝到Xcode中,並且它的構建正常。但是,我似乎很多班上都缺課。我試圖將RKRequestDelegate類作爲委託添加到我的一個視圖控制器,但是這個委託不存在。我也缺少RKRequest類。 我看過我的硬盤上的RestKit文件夾,我不能在那裏看到它們。 也許我錯過了一步。如果有其他人遇到這個問題,聽到解決方案將會很棒。RestKit - RKRequestDelegate不存在
感謝 布賴恩
我已經將RestKit安裝到Xcode中,並且它的構建正常。但是,我似乎很多班上都缺課。我試圖將RKRequestDelegate類作爲委託添加到我的一個視圖控制器,但是這個委託不存在。我也缺少RKRequest類。 我看過我的硬盤上的RestKit文件夾,我不能在那裏看到它們。 也許我錯過了一步。如果有其他人遇到這個問題,聽到解決方案將會很棒。RestKit - RKRequestDelegate不存在
感謝 布賴恩
你可能沒有做錯任何事 - 它似乎RestKit不再包含RKRequestDelegate爲0.20.0
您可以比較API文檔0.10.3和0.20.0-pre6驗證這一點。
取決於你想要使用RKRequestDelegate的,你可以使用新的代表之一或者你也可以繼承RKObjectManager(搜索RKObjectManager docs爲「定製&子類筆記」的時候,可能是適當的例子)的東西。
這就是說,我必須告誡我,我也不確定「正確」方法對於我所面臨的問題(how to retry a request after re-authenticating)有何不確定性,並且無法在文檔中找到任何明確的方法。希望你的用例更清楚。
這裏有一個維基大約從0.10.x升級到0.20.0:
https://github.com/RestKit/RestKit/wiki/Upgrading-from-v0.10.x-to-v0.20.0
正如你看到的,確實是一個大的變化。而對於RKRequestDelegate
,因爲它說:
The delegate protocols RKRequestDelegate and RKObjectLoaderDelegate have been removed from the project in favor of block based approaches. The most common, required methods of these protocols such as request:didLoadResponse:, request:didLoadError:, objectLoader:didLoadObjects:, and objectLoader:didLoadError: have been replaced with completion blocks on the AFHTTPRequestOperation and RKObjectRequestOperation classes. In general, these completion blocks are specified as a pair of success and failure blocks
似乎棘手..
感謝您的回答。遺憾的是,如果在線升級restkit的示例現在看起來已經過時了,那麼這個更新是最爲遺憾的 –