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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to