Alert

Hi,


does anybody know if there is a way to show a NSAlert when the "messageReceived" event is called?


If I create an alert in the event I get this message: "warning: unable to obtain service marshal for app-modal session"

Replies

For some unknown reasons, the whole AppKit engine works only once the Popover has been opened (probably there are some internal initializations).


You can trigger it by doing this:

SFSafariApplication.getActiveWindow { (window) in
  window?.getToolbarItem(completionHandler: { (item) in
  item?.showPopover()
  })
  }

Then put your code inside:

overridefunc viewDidAppear() {
// Do here your AppKit code
  }

For some reasons, its not possible to use modals in Safari Extensions. Don't know why.

The ability to use AppKit widgets is very limited. I use NSPanels.