download a .mp3 file on Website with NSSURLConnection

吃可爱长大的小学妹 提交于 2019-12-13 03:49:18

问题


I want to download a .mp3 file on a Website with NSSURLConnection, however only the first 357 bytes of the 2.5 mb file are downloaded.

I tried to increase the buffer size and the timeout of the request, but I still can't get the entire .mp3 file on the iPhone.

This URL of the file is:

http://dl.mp3.kapsule.info/fsfsdfdsfdserwrwq3/fc90613208cc3f16ae6d6ba05d21880c/4b5244f0/b/7e/b7e80afa18d06fdd3dd9f9fa44b51fc0.mp3?filename=Every-Day-I-Love-You.mp3

How can I make the iPhone download the whole file?

Thank you very much.


回答1:


Are you using -sendSynchronousRequest:returningResponse:error: or the asynchronous methods?

If you're using a delegate and the callbacks, remember that -connection:didReceiveData: can be called multiple times; you should create an NSMutableData object and append each data block to that.



来源:https://stackoverflow.com/questions/2081268/download-a-mp3-file-on-website-with-nssurlconnection

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