WebClient in Monotouch does not finish file downlo

2019-06-10 16:56发布

问题:

I am finishing the development of an application using monotouch that downloads video files. Something like the TEDTalks app. But I am having the problem that the WebClient.DownloadFileAsync doesn't finish downloading the files reliably, but every so often hangs at some point and doesn't continue downloading the file. The problem is worst with larger files, although I have monitored the memory usage of the app and is not affected by size of the file being downloaded. The filestream that I used to write the file locally is flushed regularly. I tried rewriting the class to use a HttpWebRequest with the same results.

Any ideas would be appreciated, thanks.

回答1:

MonoTouch 4.2 has many bug fixes including quite a few related to WebClient and HttpWebRequest (one of them very similar to your description). You should definitively update and try the latest 4.2.2. If it still does not work like expected please fill a bug report at http://bugzilla.xamarin.com and include a test test.



回答2:

Are you on the latest MT 4.0.3? 4.0 - 4.0.2 had some networking problems