We encounter following GUI issue on Mac OSX 10.11 Beta 8 (build 15A279b)
With Xcode 7, in a project targeting OSX 10.8, 10.9, 10.10 and 10.11, we create a command line tool application. In the application main function, we create a NSAlert object with an OK button and use the runModal method to display it. When we run this application:
- On OSX 10.11, the alert is displayed as expected, but when clicking the OK button, the alert stays displayed until the application itself quits. Moreover, if we try to display a second alert, the previous one disappears and the new one stays displayed after we have clicked the OK button.
- On OS X 10.8, 10.9 or 10.10, when clicking the OK button, the alert is properly closed as expected.
The project has been built with Xcode 7, but occurs with Xcode 6.4 as well.
Is that a known issue ? How can we recover the behaviour of previous versions on OS X 10.11 ?
---------------
Sample code to reproduce the issue:
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
int main(int argc, const char * argv[]) {
/
@autoreleasepool {
NSAlert* msgBox1 = [[NSAlert alloc] init];
[msgBox1 setMessageText: @"Welcome !"];
[msgBox1 addButtonWithTitle : @"OK"];
[msgBox1 runModal];
}
int c=0;
/ On OSX 10.11: msgBox1 stays displayed when clicking the OK button
printf(" --------- Hit a key to display a second alert ----------\n");
c=getchar();
/
@autoreleasepool {
NSAlert* msgBox2 = [[NSAlert alloc] init];
[msgBox2 setMessageText: @"Welcome !"];
[msgBox2 addButtonWithTitle : @"OK"];
[msgBox2 runModal];
}
/
/
printf(" --------- Hit a key to exit ----------\n");
c=getchar();
return 0;
/
}