Hi, I have a simple window with a WebView and an NSButton that I want to display as a modal window. The window is loaded from a NIB using MyCompanyAlertController, that also acts as the WebView's delegate (set in the NIB).
When run as a sheet in my main window (using method showAlertInSheet: below) the webView loads its contents and calls its didFinishLoadForFrame: delegate method as expected. I cannot make it work when I am trying to display the window as an NSApp modal window with method showAlertModal: below. What is that I am missing? I am using Xcode 7.1 on OS X 10.11.1 and deployment target is set to 10.9. Thanks for any help, - Christos Konidaris - (void) showAlertInSheet: (NSDictionary *) alertDict { MyCompanyAlertController *alertWC = [[MyCompanyAlertController alloc] initWithAlert: alertDict]; NSWindow *alertWindow = [alertWC window]; [alertWC initLoading]; [self.window beginSheet: alertWindow completionHandler: ^(NSModalResponse returnCode) { [alertWindow orderOut: nil]; [alertWindow close]; [self performSelector: aSelector]; }]; } - (void) showAlertModal: (NSMutableDictionary *) alertDict { MyCompanyAlertController *alertWC = [[MyCompanyAlertController alloc] initWithAlert: alertDict]; NSWindow *alertWindow = [alertWC window]; [alertWC initLoading]; NSModalSession theSession = [NSApp beginModalSessionForWindow: alertWindow]; NSInteger response = NSModalResponseContinue; while (response == NSModalResponseContinue) { response = [NSApp runModalSession: theSession]; [[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode beforeDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]]; } [NSApp endModalSession: theSession]; [[alertWC window] orderOut: nil]; … } - (void) initLoading { NSString *messageUrl = [self.alertDict objectForKey: @"message-url"]; self.window.title = [alertDict objectForKey: @"title”]; [theWebview setPolicyDelegate: self]; if ((messageUrl != nil) && ([messageUrl length] > 0)) { NSURL *reqURL = [NSURL URLWithString: messageUrl]; [[theWebview mainFrame] loadRequest: [NSURLRequest requestWithURL: reqURL]]; } } _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com