UIDocument openWithCompletionHandler: called on what thread?
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