tags:

views:

30

answers:

1

Hi All,

I need to create a dialog from a thread. Im loading a nib file within the thread using the "initwithwindowNibName" and trying to popup the dialog using "[nsapp runmodalforwindow]",but the dialog is not popping up..

Please help me out.

+3  A: 
AppKit, the GUI framework, is not thread safe. In order for things to work properly, you (almost) always need to update GUI classes from the main thread

Dave Dribin, Invoke on Main Thread

Basically, you'll want to do something like:

[objectThatShowsTheDialog performSelectorOnMainThread:@selector(showTheDialog:)
                                           withObject:anObject
                                        waitUntilDone:NO];

to call the code that puts up the dialog on the the main thread.

Vincent Gable
Thank you for the suggestion.I thnk i dont have any other alternative.......
Pradeep Kumar