views:

28

answers:

1

Hi there.

I have an iphone app which has an NSURLConnection downloading a large video file. It takes about 5-10 minutes to download (a little bit of data at a time).

There are some problems though.

If the iPhone is just left on the side to download then the screen turns off and the iPhone locks. This seems to cause the download to stop. (and calls connection:didFailWithError:).

Sometimes as well the download will finish well before it is supposed to. For instance it will download the first 20 seconds of a 3 minute film and then call connectionDidFinishLoading:.

I have no idea why this is happening. If I download a smaller film (say 15seconds) then it works perfectly, I just don't know why it chokes on the larger files, or could it just be my internet connection?

Thanks Tom

+1  A: 

See this stackoverflow answer.You have to mention the timeout interval.

All the best.

Warrior
hmm... what does that do exactly? ie: what would I set the timeout to? Would I set it to the time it SHOULD take to download the video? Thanks a lot for you help. :)
Thomas Clayson
It will hold your connection for the time you mentioned,so your connection does not get failed.
Warrior
oh brilliant - so if I set it to like 10 minutes (600s) then it should easily complete my downloads? Brilliant. Thank you very much. :)
Thomas Clayson