Hello,
I am creating a Safari App Extension. I downloaded the Sea Creator example project.
I want to send messages between the extension and javascript. According to the documentation provided by Apple I should be able to do it with the following function:
override func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String : AnyObject]!) {
page.dispatchMessageToScript(withName: "simpleMessage", userInfo: nil)
page.dispatchMessageToScript(withName: "complexMessage", userInfo: ["myKey": "myValue"])
}
In the Sea Creator project I modified the SafariWebExtensionHandler to
import SafariServices
class SafariWebExtensionHandler: SFSafariExtensionHandler {
override func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String : AnyObject]!) {
page.dispatchMessageToScript(withName: "simpleMessage", userInfo: nil)
page.dispatchMessageToScript(withName: "complexMessage", userInfo: ["myKey": "myValue"])
}
}
But I am getting a buildtime error: Cannot find type 'SFSafariExtensionHandler' in scope
I am running Xcode 13.0 beta (13A5154h) on Mac OS version 11.4
What I find weird is that I downloaded a random project from github and it doesn't throw me the same error. I am wondering if there is some additional configuration I am missing.