Not getting full download with NSURLConnection GET in iPhone app
Situation
I'm using NSURLConnection to download an mp3 file to the documents directory on my app. On the simulator I get the full mp3 file downloaded with no probs. On the device, however, I can only seem to get 1 second of audio for each mp3. I am connecting to a free WiFi point when performing this download from the device, in contrast with my T1 land-line connection that is used by the simulator.Problem
Users of my app may encounter only partial downloads of mp3 files.Question
Does this sound like a problem with the free WiFi hotspot rather than the actual app or NSURLConnection class? How should I go about troubleshooting this?P.S. - I used to use开发者_如何学JAVA [NSData dataWithContentsOfURL:URL] to download the mp3 file. It was very slow but at least I always got the ENTIRE mp3 file.
Thanks
Are you handling multiple callbacks of -connection: didReceiveData:? That will get called multiple times, and you should concatenate each data chunk into one giant NSMutableData.
精彩评论