Posts

Post not yet marked as solved
0 Replies
581 Views
Hi all!Is it possible to get bookmarks and history of the current Safari window as array inside SafariExtensionHandler.swift like bookmarks.get() and history.search() from the javascript APIs?Thanks.
Posted
by ivanodev.
Last updated
.
Post not yet marked as solved
1 Replies
1.3k Views
Hi all.I'm following this guide for the creation of a new Safari App Extension.However, once executed, nothing is logged inside the console when some events are fired.For example, when I click to the toolbar icon, this following functionoverride func toolbarItemClicked(in window: SFSafariWindow) { // This method will be called when your toolbar item is clicked. NSLog("The extension's toolbar item was clicked") }is never executed, because in the console nothing is printed.Also, the following function messageReceived does not log anything in the consoleoverride func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String : Any]?) { // This method will be called when a content script provided by your extension calls safari.extension.dispatchMessage("message"). page.getPropertiesWithCompletionHandler { properties in NSLog("The extension received a message (\(messageName)) from a script injected into (\(String(describing: properties?.url))) with userInfo (\(userInfo ?? [:]))") } }when the file script.js fires this eventdocument.addEventListener("DOMContentLoaded", function(event) { safari.extension.dispatchMessage("Hello World!"); });In the info.plist file the class is declared like this:$(PRODUCT_MODULE_NAME).SafariExtensionHandlerIt seems like the entire SafariExtensionHandler.swift is never read.The AppDelegate.swift is working normally, instead.What's the problem here? The project contains brand new code generated by Xcode.Thank you for you help.
Posted
by ivanodev.
Last updated
.