OS X アプリの ViewController に次のコードがあります。
NSAlert *alert = [NSAlert new];
alert.messageText = @"Connection error";
alert.informativeText = @"You do not appear to be connected to the internet";
[alert addButtonWithTitle:@"Third button"];
[alert addButtonWithTitle:@"Second button"];
[alert addButtonWithTitle:@"Ok"];
[alert beginSheetModalForWindow:[[self view] window] completionHandler:^(NSInteger result) {
NSLog(@"Success");
}];
// [alert runModal];
このコードを実行しても何も起こりません。beginSheetModalForWindow の行をコメントアウトし、[alert runModal] のコメントを外すと、期待どおりにアラートが表示されます。
シートとして表示されないというのは、何が間違っているのでしょうか?