如何在 Electron 应用程序中嵌入 mac 应用程序扩展? [英] How to embed a mac app extension in an Electron app?

查看:32
本文介绍了如何在 Electron 应用程序中嵌入 mac 应用程序扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我使用 编写的应用程序中嵌入一个用 Swift 编写的 Finder Sync 扩展电子.我怎样才能设法让它们一起工作并相互交流?我已阅读 Apple documentation 但它只解释了如何将目标添加到本机应用程序.我还注意到,我可以使用 电子构建器.如何在 XCode 中开发和测试扩展并将其正确嵌入到自定义 Electron 应用程序中?有什么建议吗?

I'm trying to embed a Finder Sync extension written in Swift in my app written with Electron. How can I manage to make them work together and communicate with each other? I have read the Apple documentation but it only explains how to add a target to a native application. I also noticed that I can manually inject the .appex compiled file (produced by XCode) in the application Plugins folder using electron builder. How can I develop and test the extension in XCode and embed it correctly in a custom Electron app? Any suggestion?

非常感谢您的任何建议

推荐答案

在您的 Electron 根文件夹中创建 PlugIns 文件夹.

Create PlugIns folder in your Electron root folder.

.appex 文件复制到 PlugIns 文件夹中.

Copy the .appex file into PlugIns folder.

如果您使用的是 electron-builder,请修改 package.json 文件 - 添加:"extraFiles": ["PlugIns/"] 在 "mac" 部分.

If you are using electron-builder, modify the package.json file - add: "extraFiles": ["PlugIns/"] in the "mac" section.

构建.您的应用程序包的Contents 将包含 PlugIns 文件夹和其中的 appex 文件,并且 appex 将被加载到您的应用程序的进程中.

Build. The Contents of your app package will contain the PlugIns folder and your appex file inside, and the appex will get loaded into your app's process.

这篇关于如何在 Electron 应用程序中嵌入 mac 应用程序扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆