14

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.

Community
  • 1
  • 1
Johan Karlsson
  • 1,136
  • 1
  • 14
  • 37

3 Answers3

26

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)
Johan Karlsson
  • 1,136
  • 1
  • 14
  • 37
  • 3
    +1 AFNetworking works on both MacOS and iOS.. so one learning curve => more platform benefits. – Anand Mar 23 '12 at 03:57
  • 3
    +1, AFNetworking is so much easier and cleaner to get working correctly than RestKit. I am sure there are some situations where RestKit is warranted, but for anyone who is just trying to get some fairly basic webservice communication going AFNetworking is a much better choice. – David Hay Aug 02 '12 at 22:43
  • 1
    RestKit is an overkill even if you want to use Core Data (I had to use it in multiple applications, run away from it). <3 AFNetworking <3 Alamofire – aryaxt Sep 02 '14 at 01:10
7

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.

tilo
  • 14,009
  • 6
  • 68
  • 85
  • I did not get the RestKit working the way I wanted. There was a lot of trouble and in the end it did not work properly. – Johan Karlsson Jan 30 '12 at 06:40
  • Dealing with RestKit shouldn't cause any problems - if so, you are probably misunderstanding some concepts. You could provide some details (what you wanted to do, what went wrong) to solve your problems with RestKit. – tilo Jan 30 '12 at 09:46
  • There was some missing features. For example the object mapping did handle all the special cases we needed for our current implementation. Also tried to use RestKit without object mapping, but ran into other problems, like the application hanging. I have been discussing these issues in the RestKit Google discussion group. I spent many days to get things working with RestKit. I did not have time to wait. So I was forced to try another solution. I must point out that I believe that RestKit is a good library. But for me it was not mature enough. I will keep an eye on RestKit and try it again. – Johan Karlsson Jan 30 '12 at 10:03
  • 1
    For some people the RestKit may be a better solution than AFNetworking. But I ended up using AFNetworking. I am only trying to be honest here. – Johan Karlsson Jan 30 '12 at 10:09
  • 1
    I put this back as the correct answer, since my question really was about RestKit as a replacement for ASIHTTP. But as mentioned, AFNetworking and the current implementation turned out to match better. – Johan Karlsson Jan 30 '12 at 10:41
  • Just wanted to chime in and say that RestKit has been an incredibly useful tool for me in the various apps I've developed with it. There is definitely a learning curve, but once you get over that hump it really enables you to develop powerful apps in much shorter timespans while massively reducing your codebase. There are sometimes some mapping issues, but IMO that is often due to structural issues with the APIs that are being consumed more than RestKit's fault. Along with SDWebImage it's a very powerful toolset. – Marky Oct 04 '12 at 06:01
0

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

user377808
  • 3,481
  • 2
  • 18
  • 12