Post

Replies

Boosts

Views

Activity

Display NSPanel from within SFSafariExtensionHandler
On MacOS 10.13 we could display an NSPanel from within SFSafariExtensionHandler as follows:func showPanel(_ message:String) -> NSPanel { let panel:NSPanel = NSPanel() panel.level = .floating var frame:NSRect = panel.frame frame.size = NSSize(width: 400, height:60) panel.setFrame(frame, display: true) panel.makeKeyAndOrderFront(panel) let font:NSFont = NSFont.systemFont(ofSize: 20) let attributes:[NSAttributedString.Key:Any] = [NSAttributedString.Key.font:font] let attributedString:NSAttributedString = NSAttributedString(string: message, attributes:attributes) let textField:NSTextField = NSTextField(labelWithAttributedString: attributedString) panel.contentView = textField panel.center() let application:NSApplication = NSApplication.shared application.activate(ignoringOtherApps: true) return panel }However, on MacOS Mojave 10.14 this no longer works. Instead we receive within the Console the following message:warning: attempt to begin free window rendezvous for <NSPanel: 0x600002767100> failed due to Error Domain=com.apple.ViewBridge Code=10 "(null)" UserInfo={com.apple.ViewBridge.error.hint=no host-and-service pairs, com.apple.ViewBridge.error.description=NSViewBridgeEntitlementError}Anyone knows how to display NSPanel (or NSWindow) from within a Safari App Extension?
4
0
2.3k
Oct ’18