I am currently working on an app which requires me to download audio files from web server. The URL would be something like this: http://universalstreamsolution.com/Samonas/test1.m4a .
Any suggestions on what I should do to be able to reach my goal?
I am currently working on an app which requires me to download audio files from web server. The URL would be something like this: http://universalstreamsolution.com/Samonas/test1.m4a .
Any suggestions on what I should do to be able to reach my goal?
if you need the data in the format of data, you can use the data class to download the data with the method to download the data from an URL:
[NSData dataWithContentsOfURL:URL]
also consider the answer there for playing an NSData as audio: How to play an audio if we pass NSData?
[NSData dataWithContentsOfURL:URL] works but it causes UI block so that user can not interact with device till the file is completely downloaded. Such a bad user experience. I suggest using NSURLSession with this great tutorial: http://www.raywenderlich.com/51127/nsurlsession-tutorial