Is RESTKit a good replacement for ASIHTTPRequest?

2020-03-01 06:59发布

问题:

I have been using ASIHTTPRequest for quite a while now and i quite satisfied with it. However since it has been deprecated, I am considering replacing it. My first though was to go with the NSURLConnection, but I found out that ASIHTTPRequest actually does quite a lot. For example I like its queue handling.

The iPhone application that I am working on uses a REST API, so I have been considering RESTKit. Is is possible to use RESTKit without Core Data? As it is know I have pure dataobjects and I do not want to use Core Data, not right now anyway.

Are there any other good alternatives to ASIHTTPRequest?

BTW I know that there is a similar question but this is more specific.

回答1:

I can definitely recommend RestKit, I make use of it a lot! It handles common stuff for you and no, you don't have to use Core Data. RestKit can work with it, but that is just a nice feature. A good starting point for using RestKit is the wiki on github.

RestKit relies on AFNetworking as a networking framework. If RestKit seems to be an overkill, you may want to try only this one.



回答2:

I think that AFNetworking is a good solution.

Pros:

  • Small
  • Well documented
  • Simple to install, only copy the source code into your project.
  • Simple to use.
  • An excellent category for UIImageView for loading icons in the background.

Cons:

  • No way of setting the timeout for requests. (Applies to v0.9.0)


回答3:

Try the BYRequest: BYRequest based on MKNetowrkKit, but it works like ASIHttpRequest, so you can easily migrate your project from ASIHttpRequest to BYRequest and also enjoy ARC. https://github.com/BoydYang/BYRequest