我遇到了一个问题,当沙盒被启用时,应用程序不想启动。
我在传送器里发现了错误:第一个月
如果我运行这个问题的程序,程序会像预期的那样运行。但它无法上传到App Store。沙盒已部分启用webPreferences: {..., sandbox: true }
。
我设法通过添加以下内容来解决这个问题:<key>com.apple.security.app-sandbox</key><true/>
到我的权利文件。
使用scripts:{..., "electron-package":"electron-build -m"}
重建后,应用程序将使用Developer ID Application: foo (id)
和3rd Party Mac Developer Application: food (id)
进行签名。
当执行以下命令project-folder/dist/mas/bar.app/Contents/MacOs/bar
时,它返回zsh: killed ./bar.app/Contents/MacOS/bar
,程序不再启动
如果我通过传输器上传这个版本,它确实会成功上传,但很可能会失败的苹果审查。
崩溃报告的输出为:
Incident Identifier: incident-guid
CrashReporter Key: crashreport-guid
Hardware Model: Macmini9,1
Process: Bar [16938]
Path: /Users/USER/*/bar.app/Contents/MacOS/bar
Identifier: eu.comany.bar
Version: 0.8.4 (0.8.4)
Code Type: X86-64 (Native)
Role: Unspecified
Parent Process: zsh [722]
Coalition: com.apple.Terminal [845]
Responsible Process: Terminal [720]
Date/Time: 2021-12-22 14:23:42.0103 +0100
Launch Time: 2021-12-22 14:23:41.8950 +0100
OS Version: macOS 12.1 (21C52)
Release Type: User
Report Version: 104
Exception Type: EXC_CRASH (SIGKILL (Code Signature Invalid))
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: CODESIGNING 1
Highlighted by Thread: 0
Backtrace not available
No thread state (register information) available
Binary Images:
Binary images description not available
Error Formulating Crash Report:
_dyld_process_info_create failed with 6
dyld_process_snapshot_get_shared_cache failed
Failed to create CSSymbolicatorRef - corpse still valid ¯\_(ツ)_/¯
EOF
字符串
我的权利.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.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>id.eu.company.app</string>
</array>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.device.microphone</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.automation.apple-events</key>
<true/>
</dict>
</plist>
型
我的信息.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>CFBundleIdentifier</key>
<string>CopySelected.workflow</string>
<key>CFBundleName</key>
<string>Bar by Foo</string>
<key>NSServices</key>
<array>
<dict>
<key>NSBackgroundColorName</key>
<string>background</string>
<key>NSIconName</key>
<string>NSActionTemplate</string>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>CopySelected</string>
</dict>
<key>NSMessage</key>
<string>runWorkflowAsService</string>
<key>NSSendTypes</key>
<array>
<string>public.utf8-plain-text</string>
</array>
</dict>
</array>
</dict>
</plist>
型
我的package.json包含:
"mac": {
"icon": "icons/icon.icns",
"category": "public.app-category.xxxxxxxx",
"entitlements": "entitlements.mac.plist",
"entitlementsInherit": "entitlements.mac.plist",
"provisioningProfile": "provisioning/bar.provisionprofile",
"extraResources": [
"electron/bin/**/*"
],
"target": [
"mas"
],
"binaries": [],
"extendInfo": {
"NSMicrophoneUsageDescription": "Bar requires microphone access."
}
},
型security find-identity -vp codesigning
返回(终端命令):
Developer ID application: xx (yy)
3rd Party Mac developer Application: xx (yy)
Apple Development: person (zz) //not used
Apple Distribution: xx (yy) //not used
4 valid identities found
型
我的电子构建输出:
> bar@0.8.4 preelectron-pack
> npm run build-react
> bar@0.8.4 build-react
> cross-env REACT_APP_ENV=PROD react-scripts build
Creating an optimized production build...
> bar@0.8.4 electron-pack
> electron-builder -m "mas"
• electron-builder version=22.10.5 os=21.2.0
• loaded configuration file=package.json ("build" field)
• writing effective config file=dist/builder-effective-config.yaml
• packaging platform=mas arch=arm64 electron=13.2.0 appOutDir=dist/mas-arm64
• Unpacking electron zip zipPath=undefined
• signing file=dist/mas/Bar.app identityName=Developer ID Application: xxxxxxxx (yyyyyyy) identityHash=71103A11A7D2CD51ACD921809C7358B6E28B8ACD provisioningProfile=certs/Bar.provisionprofile
• signing file=dist/mas/Bar.app identityName=3rd Party Mac Developer Application: xxxxxxxxxxxx (yyyyyyyyy) identityHash=4EF2E5C611EB01CA290E651B55BEBC2424589C3C provisioningProfile=certs/Bar.provisionprofile
型
codesign -dvvv dist/mas/Bar.app
>>> codesign -dvvv dist/mas/Bar.app
Executable=/path_to_bar/bar/dist/mas/Bar.app/Contents/MacOS/Bar
Identifier=eu.company.bar
Format=app bundle with Mach-O thin (x86_64)
CodeDirectory v=20400 size=3093 flags=0x0(none) hashes=86+7 location=embedded
Hash type=sha256 size=32
CandidateCDHash sha1=created-sha1-hash
CandidateCDHashFull sha1=created-sha1-hash
CandidateCDHash sha256=created-sha256-hash
CandidateCDHashFull sha256=created-sha256-hash
Hash choices=sha1,sha256
CMSDigest=created-cmsdigest
CMSDigestType=2
CDHash=created-cdhash
Signature size=9183
Authority=3rd Party Mac Developer Application: xxx (yyy)
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Timestamp=29 Dec 2021 at 13:39:08
Info.plist entries=31
TeamIdentifier=yyy (same id as the yyy in certificate)
Sealed Resources version=2 rules=13 files=16
Internal requirements count=1 size=208
型
pkgutil --check-signature dist/mas/Bar-0.8.4.pkg
Package "Bar-0.8.4.pkg":
Status: signed by a developer certificate issued by Apple (Development)
Certificate Chain:
1. 3rd Party Mac Developer Installer: xxx (yyy)
Expires: 2022-11-30 14:04:56 +0000
SHA256 Fingerprint:
4F 54 4F 4B 21 A4 39 95 CD 62 65 AD C8 F7 7E DD AC 77 9D 5F 39 AB
99 88 77 66 55 44 33 22 11 00
------------------------------------------------------------------------
2. Apple Worldwide Developer Relations Certification Authority
Expires: 2030-02-20 00:00:00 +0000
SHA256 Fingerprint:
DC F2 18 78 C7 7F 41 98 E4 B4 61 4F 03 D6 96 D8 9C 66 C6 60 08 D4
24 4E 1B 99 16 1A AC 91 60 1F
------------------------------------------------------------------------
3. Apple Root CA
Expires: 2035-02-09 21:40:36 +0000
SHA256 Fingerprint:
B0 B1 73 0E CB C7 FF 45 05 14 2C 49 F1 29 5E 6E DA 6B CA ED 7E 2C
68 C5 BE 91 B5 A1 10 01 F0 24
型
很有可能我做错了以下其中一件事。我试过:
- 重新实现证书
- 重做配置文件
- 基于Electron的沙盒方式
- 根据Apple Developer文档的沙盒方式
- 生成后对应用程序进行签名
- 删除某些证书
- 使用不同的证书签名(此操作不成功)
- 通过Xcode创建证书
- 尝试在xcode中导入项目失败
- 几乎所有的解决方案都是从谷歌的第一页开始的。相关职位严重缺乏。
- ...
我可能忘了一些
在过去的一周里,我找不到任何解决方案。如果您需要任何更多的故障排除信息,请让我知道?
1条答案
按热度按时间hmae6n7t1#
当我遇到“代码签名无效”错误时,this mulesoft support thread的解决方案对我有效。请注意,我在启用沙盒时没有遇到这种情况,它只是开始随机发生在我身上:
通过命令行强制签名:
字符串