@Frameworks Engineer OK, I have composed a minimal example project and created a new feedback here: https://feedbackassistant.apple.com/feedback/15231333
Post
Replies
Boosts
Views
Activity
Got it working, @Frameworks Engineer set me on the right track. Only responding to messages from javascript is OK, because in native part I can store NSExtensionContext of incoming message, and use it for response asynchronously, even half a minute later. That was everything I needed.
@Frameworks Engineer Well, I don't understand it. Here: https://developer.apple.com/documentation/safariservices/messaging-between-the-app-and-javascript-in-a-safari-web-extension it clearly says that that the native part should communicate to the javascript by dispatchMessage(). Or am I misunderstanding it? It worked in xcode 15.4.
I can't respond immediatelly to incoming message from javascript, because there is some processing to be done in the native part, and it can take some time.
For clarification, I am trying to communicate between javascript and swift part which are both in "Shared (Extension)" directory, and are part of "... Extension" target.
The idea is:
Javascript part of extension gathers urls from visited page, and sends them to native part
The native part processes urls in the background (potentially longer running process)
When url is processed, the native part of extension gives result back to javascript to show them. This is the place where I use dispatchMessage()
Both javascript and the native handling is in "Shared (Extension)" folder, if it plays some role. According to this: https://developer.apple.com/documentation/safariservices/messaging-between-the-app-and-javascript-in-a-safari-web-extension , dispatchMessage is the way to use ... and it worked in xcode 15.4
Thanks. Does it mean that if I create a new scene by myself through requestSceneSessionActivation(), I will never be able to open window on the position I want, no matter what I do? The only way is to first let window show at default location, and then acquire NSWindow and move it by appkit means? SIze restrictions work for size, I appreciate that, but position is also important for me.
Same problem here, but even without changing target name. Any menu throws this error when opened. Have you found a solution?