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

与世无争的帅哥 提交于 2019-12-19 03:06:36

问题


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 using 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)


回答1:


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



来源:https://stackoverflow.com/questions/2204010/how-to-use-nsurlrequest-nsurlconnection-to-download-an-mp3-file-to-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!