16

I've recently read the news on http://allseeing-i.com that ASIHTTP is being discontinued. I have much respect for the makers of the library. However, I am now looking for a substitute that also supports queued download (multithreaded) on iOS, that also supports a progress bar with appropriate information.

Is there any (hopefully lightweight) library, that is in an active development livecycle? ARC support would also be much appreciated.

Many thanks for your thoughts.

brainray
  • 12,512
  • 11
  • 67
  • 116

3 Answers3

5

You may want to look at MKNetworkKit. In its words:

MKNetworkKit's goal was to make it as feature rich as ASIHTTPRequest yet simple and elegant to use like AFNetworking

It has a number of very nice features for queuing and managing offline situations.

Rob Napier
  • 286,113
  • 34
  • 456
  • 610
3

AFNetworking is being lauded as a successor to ASIHTTPRequest. It is based on operation queues, and in my experience it works reasonably well. You could probably do what you want to do without a third-party library, but if you want to make it a little easier on yourself, a combination of AFURLConnectionOperation subclasses and the AFHTTPClient class will do nicely.

warrenm
  • 31,094
  • 6
  • 92
  • 116
  • Note that although some work has been done on making it ARC-compatible, the official mainline of AFNetworking code is not ARC-compatible. In the meantime, it's quite easy to apply -fno-objc-arc to the relevant files. – warrenm Feb 08 '12 at 23:57
  • I miss the simplicity of ASIHTTTP setQueueDidFinishSelector... Any replacements for AFNetworking rather than the NSOperationQueue KVO observing? That is kinda ugly.. – Carlos Ricardo Jun 26 '12 at 11:46
  • Well, the `setCompletionBlockWithSuccess:failure:` method on the `AFHTTPRequestOperation` operation class allows you to set an arbitrary block to be called on success or failure, which to me is even more elegant than using the target/action pattern. – warrenm Jun 26 '12 at 14:08
  • I meant for a queue, not for a single op – Carlos Ricardo Jun 26 '12 at 14:16
  • 1
    Ah, I misread. I suppose you could subclass `AFHTTPClient` to encapsulate the KVO code and call your own custom block or target/action when you observe a change. Or just hack it in directly. – warrenm Jun 26 '12 at 14:57
  • I already subclassed it (needed to override setCompletionBlock), will try KVO inside it :) – Carlos Ricardo Jun 27 '12 at 08:33
3

I wrote one recently. It's fully ARC compliant and fairly lightweight:

https://github.com/nicklockwood/RequestQueue

As of version 1.2 it supports download and upload progress bars (see the included ProgressLoader example).

Rather than make a monolithic framework like ASI, I've tried to keep this as simple as possible. That means you are free to mix and match it with other libraries for stuff like POST parameter generation, JSON parsing, etc.

Nick Lockwood
  • 40,865
  • 11
  • 112
  • 103