首页 > 解决方案 > Electron-forge 和 osx 签名应用程序导致“二进制文件签名不正确”。

问题描述

标签: macoselectronelectron-forge

解决方案


我使用本教程解决了这个问题:https ://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/

而这个问题https://github.com/electron-userland/electron-builder/issues/3940

我的最终配置是:

    osxSign: {
      identity: 'Developer ID Application: MyTeam (TEAMID)',
      'hardened-runtime': true,
      entitlements: 'mac/entitlements.plist',
      'entitlements-inherit': 'mac/entitlements.plist',
      'signature-flags': 'library',
      // https://github.com/electron/electron-notarize/issues/54
      'gatekeeper-assess': false,
      verbose: true,
    },

    osxNotarize: {
      appleId: 'myemail',
      appleIdPassword: 'mypassword',
    },

并且mac/entitlements.plist是:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
    <true/>
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
  </dict>
</plist>

推荐阅读