我正在为 MacOS 编写一个 electronJS 应用程序。我的构建工作正常,运行 electron-forge make
后我可以完美运行应用程序命令。该图标也出现在文件中。
然后我按照这份文件签署了我的申请:https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide使用 Electron 锻造。
#!/bin/bash
# Name of your app.
APP="YourApp"
# The path of your app to sign.
APP_PATH="/path/to/YourApp.app"
# The path to the location you want to put the signed package.
RESULT_PATH="~/Desktop/$APP.pkg"
# The name of certificates you requested.
APP_KEY="3rd Party Mac Developer Application: Company Name (APPIDENTITY)"
INSTALLER_KEY="3rd Party Mac Developer Installer: Company Name (APPIDENTITY)"
# The path of your plist files.
CHILD_PLIST="/path/to/child.plist"
PARENT_PLIST="/path/to/parent.plist"
LOGINHELPER_PLIST="/path/to/loginhelper.plist"
FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Electron Framework"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libnode.dylib"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/Contents/MacOS/$APP Helper"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/"
codesign -s "$APP_KEY" -f --entitlements "$LOGINHELPER_PLIST" "$APP_PATH/Contents/Library/LoginItems/$APP Login Helper.app/Contents/MacOS/$APP Login Helper"
codesign -s "$APP_KEY" -f --entitlements "$LOGINHELPER_PLIST" "$APP_PATH/Contents/Library/LoginItems/$APP Login Helper.app/"
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$APP_PATH/Contents/MacOS/$APP"
codesign -s "$APP_KEY" -f --entitlements "$PARENT_PLIST" "$APP_PATH"
productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH"
签名成功,生成myapp.pkg
文件。然后我尝试提交此
myapp.pkg
使用 Transporter https://apps.apple.com/us/app/transporter/id1450874784 连接到 Apple App Store它可以成功提交应用程序,但我的应用程序图标(正确显示在我的桌面上)没有出现在这里或 App Store Connect 中,而是显示它的默认图标。
我正在使用 .icns 文件。任何关于如何让我的图标出现的想法将不胜感激。
最佳答案
如果您将此文件添加到您的 Electron 锻造项目中,entitlements.mac.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.disable-library-validation</key><true/>
<key>com.apple.security.cs.allow-jit</key><true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key><true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key><true/>
<key>com.apple.security.files.user-selected.read-only</key><true/>
<key>com.apple.security.files.user-selected.read-write</key><true/>
</dict>
</plist>
以及用于集成此文件的 Electron 生成器配置:pluginOptions: {
electronBuilder: {
removeElectronJunk: true,
externals: ['typeorm', 'better-sqlite3'],
nodeIntegration: true,
mainProcessFile: 'src/main.js',
rendererProcessFile: 'src/renderer.js',
builderOptions: {
appId: "electron-app",
mac: {
icon: "./build/app-icon.icns",
entitlements: "./build/entitlements.mac.plist",
entitlementsInherit: "./build/entitlements.mac.plist",
darkModeSupport: true
},
关于node.js - ElectronJS 应用程序图标未出现在 Apple App Store Connect 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66350031/