A replacement for NSURLConnectionDownloadDelegate

In my previous post I noted that NSURLConnectionDownloadDelegate would provide a slick way to download files to the filesystem in iOS 5—but it doesn’t work unless you’re using it in a Newsstand app.

If you’re an old hand at Cocoa, you may remember the NSURLDownload class. It did essentially the same thing: filesystem downloads from a URL. But it’s never been available on iOS.

Enter AEURLDownload. It’s a dead simple class to asynchronously download a URL to the local filesystem. It uses NSURLConnection behind the scenes and saves to a temporary file which is properly created with mkstemp, so it’s safe even for use in non-sandboxed apps. When the file finishes downloading, your completion block is called so you can move the file where you want it. If you’re looking for NSURLDownload for iOS, AEURLDownload is what you want.

It doesn’t have progress callbacks yet, but stay tuned; they’re coming soon.