尝试使用 chrome 扩展程序连接到 Mac 上的本机应用程序时出错

问题描述

我正在创建一个 chrome 扩展程序,我正在使用本机消息传递尝试与本机应用程序进行通信,但不知何故它在 mac 上无法正常工作。

这是我的 chrome 扩展清单相关部分:

 "permissions": ["nativeMessaging"]

这是消息传递主机的 manifest.json

{
    "name": "com.my_company.my_app","description": "My Application","path": "/path_to_app/my_app.app","type": "stdio","allowed_origins": ["chrome-extension://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/"]
}

以下是我从 background.js 脚本中调用主机的方式:

const { runtime } = chrome

let port = runtime.connectNative('com.my_company.my_app')

最后这是我在 background page 控制台上遇到的错误:

无法启动本机消息传递主机。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)