简体   繁体   English

如何通过 safari web 扩展打开本地应用程序?

[英]how to open local app through safari web extension?

Given the allowed bidirectional communication between the JS component and the local (Mac) app, how can I open the local application using a message from the web component?鉴于 JS 组件和本地 (Mac) 应用程序之间允许的双向通信,我如何使用来自 web 组件的消息打开本地应用程序?

I am able to send messages between the components but the current safari web extensions context does not allow the usage of UIApplication.sharedApplication.openURL (as in, UIApplication is not really loaded).我能够在组件之间发送消息,但当前的 safari web 扩展上下文不允许使用UIApplication.sharedApplication.openURL (如 UIApplication 没有真正加载)。

Since UIApplication cannot be used in this context, NSWorkspace.shared.open(<App url>) did the trick.由于UIApplication不能在这种情况下使用,因此NSWorkspace.shared.open(<App url>)成功了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Safari浏览器扩展程序中如何单击工具栏上的打开应用程序窗口? - How to open app window on toolbar click in safari app extension? 如何在Safari App Extension中加载本地HTML文件 - How do I load a local HTML file in a Safari App Extension 如何通过应用程序扩展(iWatch)取消计划的本地通知(在iPhone上) - How to cancel scheduled local notification (on iPhone) through the app extension (iWatch) “退出并打开 safari 扩展首选项”按钮不起作用。 (将 Chrome 扩展转换为 Safari Web 扩展时) - "Quit and Open safari extension preferences" button not working. (While converting Chrome extension to Safari Web Extension) 如何以编程方式打开Safari Extension ToolbarItem popover - How to open Safari Extension ToolbarItem popover programmatically 如何使用Swift在我的应用程序的“今日扩展”中的Safari中打开url - How to open a url in Safari from my Today Extension within my app using Swift 如何在 Safari 上打开本地 html 文件? - How to open local html file on Safari? 从我的应用程序中的“今日扩展”(窗口小部件)打开Safari - Open Safari from my Today Extension (widget) within my app 如何在Safari App Extension中将OAuth与Facebook结合使用 - How to use OAuth with Facebook in a Safari App Extension 如何在 Safari App Extension 中获取活动标签? - How to get active tab in a Safari App Extension?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM