I know what you are think, why would he want to run an Asynchronous method in a background thread? The answer is that I am downloading some files locally and the local write process takes a lot of time hanging the UI. This is the case even if I use the async methods of the FileStream class, and creating a new thread every time that ReceivedData is called is to resource intensive, not to mention it opens a lot of problems securing the integrity of the file. All these would of course not be a problem when using the .net classes WebClient or HTTPWebRequest. Only that as mentioned elsewhere questions/6282278 these classes doesn’t work reliably.
I have tried running the NSUrlConnection from a BackgroundWorker, a ThreadPool.QueueUserWorkItem, a NSOperationQueue, and for some reason NSUrlConnection only seems to work when called from the Main Thread. Any ideas would be appreciated, thanks.
I’d just use the standard .Net classes: HttpWebRequest or WebClient.
I’d avoid any NS-Apple APIs if possible.