开发者

How to use NSURLRequest / NSURLConnection to download an mp3 file to app?

开发者 https://www.devze.com 2022-12-19 00:09 出处:网络
The Situation In my app, I am currently downloading an mp3 file (to docs directory) using [NSData dataWithContentsOfURL:URL], a method that works fine, but ties down the CPU, dissallowing screen updat

The Situation

In my app, I am currently downloading an mp3 file (to docs directory) using [NSData dataWithContentsOfURL:URL], a method that works fine, but ties down the CPU, dissallowing screen updates of download status. So, I want to download usi开发者_如何学编程ng a different method so that I can update the screen WHILE downloading to alert the user that the download has begun.

Question

How do I set up my viewController to use NSURLRequest or NSURLConnection to download an mp3 file? (please give source)


Use "NSURLConnection asynchronously" search for the term and you'll find source. Or just NSURLConnection.

For example:

NSURLConnection NSURLRequest proxy for asynchronous web service calls

0

精彩评论

暂无评论...
验证码 换一张
取 消