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

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

问题描述

我正在尝试在用编写的应用中嵌入用Swift编写的 Finder Sync扩展.电子.我如何设法使他们一起工作并相互交流?我已经阅读了Apple 文档,但仅说明了如何向本机应用程序添加目标.我还注意到,我可以使用电子生成器. 如何在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.

如果您使用的是电子生成器,请修改 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.

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

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