使用NSSURLConnection在网站上下载.mp3文件 [英] download a .mp3 file on Website with NSSURLConnection

查看:100
本文介绍了使用NSSURLConnection在网站上下载.mp3文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用NSSURLConnection在网站上下载.mp3文件,但是仅下载了2.5 mb文件中的前357个字节.

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.

我试图增加缓冲区大小和请求的超时时间,但是我仍然无法在iPhone上获取整个.mp3文件.

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.

文件的此URL为:

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

如何让iPhone下载整个文件?

How can I make the iPhone download the whole file?

非常感谢您.

推荐答案

您在使用-sendSynchronousRequest:returningResponse:error:还是异步方法?

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

如果使用委托和回调,请记住-connection:didReceiveData:可以多次调用;您应该创建一个NSMutableData对象,并将每个数据块附加到该对象.

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.

这篇关于使用NSSURLConnection在网站上下载.mp3文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆