I am newbie in objective-c.I want to pause the execution of main thread until my application keyWindow has been closed.I have tried by following code
[mywindow performSelector:@selector(isVisible:) onThread:[NSThread currentThread] withObject:self waitUntilDone:YES];
It's hold the execution.After close mywindow main thread doesn't execute(Paused in same line).How can I do it?
This is not possible; It's a paradox: The code responsible for the window closing must occur on the main thread (because it is AppKit/UI code). If you block the main thread waiting for the window to close, then the window can never close, because the main thread is blocked. Any attempt to block the main thread until the window closes logically reduces to a deadlock.