• 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
UIDocument openWithCompletionHandler: called on what thread?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UIDocument openWithCompletionHandler: called on what thread?


  • Subject: UIDocument openWithCompletionHandler: called on what thread?
  • From: Roland King <email@hidden>
  • Date: Mon, 03 Sep 2012 21:29:01 +0800

Here's a small snippet from the docs for UIDocument's openWithCompletionHandler:

	Parameters
		completionHandler
	A block with code to execute after the open operation concludes. The block returns no value and has one parameter:
		success
		YES if the open operation succeeds, otherwise NO.

	The block is invoked on the main queue.

I have a subclass of UIDocument, this is my openWithCompletionHandler override, I need to cache something at the point the document is opened and closed ..

	-(void)openWithCompletionHandler:(void (^)(BOOL))completionHandler
	{
		// after the open, recalcuate the topic
		[ super openWithCompletionHandler:^(BOOL success){
			[ self cacheTopic ];
			if( completionHandler )
				completionHandler( success ); 	// <-- I'm here
		} ];
	}


I'm in the debugger right now at the 'completionHander( success )' call and I'm on Thread 11. That is not the main thread, harder to show but if I type this into LLDB  ..

	(lldb) p (BOOL)[ NSThread isMainThread ]
	(BOOL) $2 = NO
	(lldb)

Is there something entirely braindead I am missing here or should I be on the main queue and thus on the main thread if the documentation is correct?





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: UIDocument openWithCompletionHandler: called on what thread?
      • From: Luke Hiesterman <email@hidden>
  • Prev by Date: Re: Create custom NSTableView with a button inside
  • Next by Date: Re: UIDocument openWithCompletionHandler: called on what thread?
  • Previous by thread: Re: Create custom NSTableView with a button inside
  • Next by thread: Re: UIDocument openWithCompletionHandler: called on what thread?
  • Index(es):
    • Date
    • Thread