• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSURLDownload notifies on wrong thread?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSURLDownload notifies on wrong thread?


  • Subject: NSURLDownload notifies on wrong thread?
  • From: "Doug Knowles" <email@hidden>
  • Date: Sun, 3 Jun 2007 22:24:49 -0400

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


  • Follow-Ups:
    • Re: NSURLDownload notifies on wrong thread?
      • From: Robert Nicholson <email@hidden>
    • Re: NSURLDownload notifies on wrong thread?
      • From: Brad Miller <email@hidden>
  • Prev by Date: IBPalette Project: Drop NSActionCell proxy icon into NSTableColumn --> Weirdness
  • Next by Date: Re: NSSegmentedCell in table column
  • Previous by thread: IBPalette Project: Drop NSActionCell proxy icon into NSTableColumn --> Weirdness
  • Next by thread: Re: NSURLDownload notifies on wrong thread?
  • Index(es):
    • Date
    • Thread