Re: NSURLDownload notifies on wrong thread?
Re: NSURLDownload notifies on wrong thread?
- Subject: Re: NSURLDownload notifies on wrong thread?
- From: Brad Miller <email@hidden>
- Date: Mon, 4 Jun 2007 13:46:50 -0700
It's a known bug. I filed a bug report on it in January 2005
(radar://3958646) and it was marked as a duplicate of radar://
3544581. File another report on it. The more reports the better.
NSURLConnection works correctly. I ended up using one instead of
NSURLDownload and then saving the document myself.
Brad
On Jun 3, 2007, at 7:24 PM, Doug Knowles wrote:
I'm so certain about this that I'm going to file a bug on it, but I'm
posting it here to see if anyone else has seen it either knows what I
might be doing wrong or how to work around it.
My app initiates an NSURLDownload fetch an RSS feed from a thread
other than the main thread. According to the NSURLDownload
documentation, the callbacks all occur on the thread that initiates
the request. My NSLog calls suggest otherwise:
2007-06-03 11:14:36.223 SLNavigator[6731] [rssListener-7]
initiateDownloadForFeed RSSFeed '':
http://macslash.org/rss/macslash.xml...
2007-06-03 11:14:36.231 SLNavigator[6731] [rssListener-7] ...started
download <NSURLDownload: 0x3828d0>
2007-06-03 11:14:36.235 SLNavigator[6731] [rssListener-7]
downloadDidBegin for <NSURLDownload: 0x3828d0>
2007-06-03 11:14:37.068 SLNavigator[6731] [Main Thread]
downloadDidFinish for <NSURLDownload: 0x3828d0>
The strings in brackets ("rssListener-7" or "Main Thread") are strings
I attach to every thread so I know where things are happening. It's
pretty clear to me that I'm initiating the URL request on
"rssListener-7" and all of the notifications except for
downloadDidFinish are coming in to the same thread. The evidence is
prettty strong that the "...didFinish" notice is coming to the wrong
thread. My app fails because the "didFinish" handler tries to access
an object that was created on the initiating thread.
Most of my NSURLDownload instances do not exhibit this problem. I
have evidence that wrong-thread notifications are occurring on errors
(such as a request timeout) as opposed to successful downloads, if
that helps.
Any comments welcome. TIA.
Doug K;
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden