我正在尝试使用 Electron Forge 构建并签署 MacOS 电子应用程序以进行自我分发,但如果我将
com.apple.developer.associated-domains
添加到我的权利中,我会收到应用程序启动错误 Library not loaded: @rpath/Electron Framework.framework/Electron Framework
。
但是,如果我从应用程序手动设置配置文件
/Contents/embedded.provisionprofile
,它将启动而不会出现任何错误,并且通用链接功能也可以工作。
如果我从权利中删除
com.apple.developer.associated-domains
选项,它也会启动而不会出现任何错误,但通用链接功能显然不起作用。
我应该如何签署我的应用程序以避免手动配置文件安装?
forge.config.ts
osxSign: {
identity: 'Developer ID Application: ***',
provisioningProfile: './embedded.provisionprofile',
optionsForFile: () => ({
entitlements: './entitlements.plist'
})
},
embedded.provisionprofile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.device.bluetooth</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.device.print</key>
<true/>
<key>com.apple.security.device.usb</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:mydomain.com</string>
<string>webcredentials:mydomain.com</string>
</array>
</dict>
</plist>
提供个人资料权利
'com.apple.developer.associated-domains': '*',
'com.apple.application-identifier': 'ZZ67H7XXXX.pro.***.***',
'keychain-access-groups': [ 'ZZ67H7XXXX.*' ],
'com.apple.developer.team-identifier': 'ZZ67H7XXXX'
我自己解决了。刚刚从 electro-forge 转移到 electron-builder,具有相同的证书、配置和配置文件集,现在它按预期工作。