Electron 应用好不容易搞定签名,打包,就卡在最后一步 Transporter 了

270 天前
 ChrisFreeMan

用的 Electron Forge 脚手架,好不容易搞定签名打包的问题,现在就差最后一步了,但是卡在 Transporter 的校验上了,说我的 plist 文件里面 CFBundleExecutable key 不合法,但是我检查了个遍都是和执行文件一样的名字,网上也没有找到任何有价值的信息。很难受,有知道的老哥吗。

能解决请一杯咖啡 (免费应用,本人不富有)

这是我的打包配置

  packagerConfig: {
    appBundleId: `ChrisFreeManDev-hotmail.com.${appName}`,
    appCopyright: `© ${(new Date()).getFullYear()} ${appName}`,
    buildVersion: '8',
    executableName: appName,
    appCategoryType: 'public.app-category.productivity',
    asar: true,
    osxUniversal: {
      x64ArchFiles: 'leveldown.node',
    },
    osxSign: {
      type: 'distribution',
      identity: 'Apple Distribution: MyName (SomeCertID)',
      provisioningProfile: './some-production.provisionprofile',
      optionsForFile: () => {
        return {
          hardenedRuntime: true,
          entitlements: './entitlements',
        }
      }
    },
    icon: './src/resources/icon/AppIcon'
  },
  rebuildConfig: {},
  makers: [
    new MakerPKG({
      identity: '3rd Party Mac Developer Installer: MyName (SomeCertID)',
      install: './out',
      name: appName
    }, ['mas'])
  ],

PS 发在 electron 节点没人看,一晚上才 10 个点击😫

2591 次点击
所在节点    程序员
24 条回复
NouveauNom
270 天前
先看下.app 里面的 info.plist CFBundleExecutable 值是多少
NouveauNom
270 天前
这个看样子是你目前没有这个值
ChrisFreeMan
270 天前
@NouveauNom 都有的主 plist 里面有 CFBundleExecutable, 然后在 Frameworks 下面的 4 个 helper 以及 Electron Framework 的 plist 都检查过了,所以我觉得很奇怪。。。
Belmode
270 天前
Belmode
270 天前
还有可能要考虑一下文件编码和 Unicode 零宽字符的问题
ChrisFreeMan
270 天前
@Belmode 他的第一个图片是针对 Xcode 的环境的,因为它是个占位符,Xcode 会在打包后自动填充,而我已经在打包后的应用检查过了,都没有问题,我在上面解释了。第二个图片也是错的,CFBundleExecutable 是指定的二进制可执行文件的。
ChrisFreeMan
270 天前
@Belmode 我的应用名称是纯英文的,编码都是 utf-8
NouveauNom
270 天前
把 plist 发下看下,CFBundleExecutable 得值是什么,是否触发了关键词
ChrisFreeMan
270 天前
@NouveauNom
```xml
<?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>CFBundleDisplayName</key>
<string>Simark</string>
<key>CFBundleExecutable</key>
<string>Simark</string>
<key>CFBundleIconFile</key>
<string>electron.icns</string>
<key>CFBundleIdentifier</key>
<string>ChrisFreeManDev-hotmail.com.Simark</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Simark</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>8</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTSDKBuild</key>
<string>22E245</string>
<key>DTSDKName</key>
<string>macosx13.3</string>
<key>DTXcode</key>
<string>1431</string>
<key>DTXcodeBuild</key>
<string>14E300c</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSEnvironment</key>
<dict>
<key>MallocNanoZone</key>
<string>0</string>
</dict>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>This app needs access to Bluetooth</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>This app needs access to Bluetooth</string>
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to the microphone</string>
<key>NSPrincipalClass</key>
<string>AtomApplication</string>
<key>NSQuitAlwaysKeepsWindows</key>
<false/>
<key>NSRequiresAquaSystemAppearance</key>
<false/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>© 2023 Simark</string>
<key>ElectronAsarIntegrity</key>
<dict>
<key>Resources/app.asar</key>
<dict>
<key>algorithm</key>
<string>SHA256</string>
<key>hash</key>
<string>5a3b8dd2e1e307b64a7f84579e7fcc78552b1a8c7bb5a659108902410fd96fd8</string>
</dict>
</dict>
</dict>
</plist>
```
这是主 plist
BlackHole1
270 天前
在 2019 年的时候,forge 修复了类似的问题:
1. https://github.com/electron/electron-packager/pull/1046
2. https://github.com/electron/forge/pull/1118

你可以确认下你的 forge 版本是否是最新的。如果不是尝试升级到最新。如果依旧不行的话,你可以尝试构建 DMG ,而非 PKG ,我怀疑是 MakerPKG 的问题
ChrisFreeMan
270 天前
@BlackHole1 我用的是 6.3.0 的版本,DMG 不能上传到 Transporter 耶,好像 DMG 是自由分发的格式类似 Zip ,就是方便拖入到应用库
BlackHole1
270 天前
你是想公证还是想上架到 apple store ?如果是公证不需要 pkg 。
BTW ,你可以在打包之前输入: export DEBUG=* 方便看到详细的日志。
以及你可以在 electron/forge 里建立一个 issue
ChrisFreeMan
270 天前
@BlackHole1 Transporter 就是用来上传到 App Store 的,forge issue 也已经提交了😂,我是走投无路才来 v 站的。实在不行我只有去翻 osxSign 的源码了😭
NouveauNom
270 天前
换个名字试试吧,看不出来别的异常了
BlackHole1
270 天前
@ChrisFreeMan #13 方便发下 issues 的 URL 么?
ChrisFreeMan
270 天前
ChrisFreeMan
270 天前
@NouveauNom 我试试吧
ChrisFreeMan
270 天前
@NouveauNom 一样的😭,总之还是谢谢了
sipt
270 天前
```
optionsForFile: () => {
return {
hardenedRuntime: true,
entitlements: './entitlements',
}
}
```
./entitlements ?
./entitlements.plist ??
ChrisFreeMan
270 天前
@sipt 这里指向的应该是一个目录,因为签名需要有个父证书,和子证书。
```md
entitlements/
- default.mas.child.plist
- default.mas.plist
```

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/965752

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX