RestKit - RKRequestDelegate does not exist

2019-07-17 04:03发布

I've installed RestKit into Xcode and it builds fine. However, I seem to be missing at lot of classes. I am trying to add The RKRequestDelegate class as a delegate to one of my view controllers but this delegate does not exist. I'm also missing RKRequest class. I've looked in the RestKit folder on my hard drive and I cant see them there. Perhaps I've missed a step along the way. If anyone else has come across this it would be great to hear a solution.

Thanks Brian

标签: ios restkit
2条回答
啃猪蹄的小仙女
2楼-- · 2019-07-17 04:05

Here's a wiki about upgrading from 0.10.x to 0.20.0:

https://github.com/RestKit/RestKit/wiki/Upgrading-from-v0.10.x-to-v0.20.0

As you see, really a big change.. And for RKRequestDelegate, as it said:

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

seems tricky..

查看更多
Explosion°爆炸
3楼-- · 2019-07-17 04:25

You probably didn't do anything wrong – it seems RestKit no longer contains RKRequestDelegate as of 0.20.0

You can compare the API docs for 0.10.3 and 0.20.0-pre6 to verify this.

Depending on what you wanted to use RKRequestDelegate for, you could use one of the new delegates or perhaps you could also subclass RKObjectManager (search the RKObjectManager docs for "Customization & Subclassing Notes" for examples of when that might be appropriate).

That said, I must caveat that I too am uncertain how what the "right" approach is for the problem I'm facing (how to retry a request after re-authenticating) and haven't been able to find anything definitive for that in the docs. Hopefully your use case is more clear cut.

查看更多
登录 后发表回答