> On Apr 1, 2015, at 5:36 AM, Quinn The Eskimo! <[email protected]> wrote: > > On 31 Mar 2015, at 21:00, Daryle Walker <[email protected]> wrote: > >> Everything has been working for the past few trials, then spontaneously >> stopped working. Now I’m getting '“TempFile.whatever” doesn’t exist’ errors. > > Two things: > > o Make sure you're delegate queue is a serial queue (set > maxConcurrentOperationCount to 1). Without that it's very easy to tie > yourself up in knots here. > > o Are you sure that the file was created in the first place? I've seen > situations where the download failed but > -URLSession:downloadTask:didFinishDownloadingToURL: was called anyway and the > file didn't exist. I haven't yet got to the bottom of the problem but I > suspect it's related to a race condition described in the DevForums post > referenced below. > > <https://devforums.apple.com/message/1115836#1115836>
I use the main thread ([NSOperationQueue mainQueue]) as the delegate queue. (I don’t have a delegate class, leaving that job to NSURLSession’s automatic delegate.) The problem only started when I added the code to not move the temporary file when it is already on the same volume as the destination directory. (The problem happens about half of the time.) And it went away when I “#if 0” that code (so the file is unconditionally moved). That’s why my reasonable guess was that running this function blows some sort of timer the task handler has on keeping the file. — Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com This email sent to [email protected]
