3

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?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • https://www.google.co.in/search?q=download+audio+files+from+web+server&oq=download+audio+files+from+web+server&aqs=chrome..69i57.357j0j7&sourceid=chrome&es_sm=91&ie=UTF-8#q=download+audio+files+from+web+server+IN+IOS and http://stackoverflow.com/questions/15749486/sending-an-http-post-request-on-ios/15749527#15749527 – iPatel Jun 09 '14 at 10:43
  • Your title is a bit misleading. I'm not sure what this has to do with HTML at all. So I have amended your tag and title. – Popeye Jun 09 '14 at 10:52

2 Answers2

1

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?

Community
  • 1
  • 1
Lorenzo Boccaccia
  • 6,041
  • 2
  • 19
  • 29
  • well, there was really much more to explain. why everything must be a school lesson in developing? sometime, an answer is just an answer – Lorenzo Boccaccia Jun 09 '14 at 10:49
1

[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

Thanh-Nhon Nguyen
  • 3,402
  • 3
  • 28
  • 41