Search code examples
xcodemacosmodal-dialogappstore-approval

Mac OS X Application modal window does not close


I've been trying to submit an application for the Apple App store and the reviewer claims that my initial notice window (which is modal) does not go away when they hit the accept button. Now I've tested it on several machines (even clean 10.7.1 installations) and have not seen this behavior (it works great for me).

My code to display this window:

- (IBAction) doAlert:(id)sender {
    if(self.alertVC == nil) {
        self.alertVC = [[[AlertVC alloc] initWithWindowNibName:@"AlertVC"] autorelease];
    }
    [NSApp runModalForWindow:self.alertVC.window];
}

and the code with which I close it looks like this:

-(IBAction)closeWindow:(id)sender {
    [self close];
    [NSApp stopModal];
}

Anyone have any idea why this works 100% in all my tests but for the Apple testers the window does not go away? (It stays open in the foreground even though the application continues and they can interact with the application as normal again.


Solution

  • The only thing I see, that may cause the error is, that you are not closing the window, but the controller (or who else provides the method closeWindow) If closeWindow is a method of the same class than doAlert the code should look like:

    -(IBAction)closeWindow:(id)sender {
        [self.alertVC.window performClose:self];
        [NSApp stopModal];
    }
    

    I know the answer is late and you probably have found a solution, but I provided the answer for all those stumbling over the snippet and wondering, why it happens to them as well.