gpt4 book ai didi

macos - Electron/类星体-在签名和沙箱之后如何运行Mac应用程序?

转载 作者:行者123 更新时间:2023-12-03 12:21:54 30 4
gpt4 key购买 nike

我有一个Quasar/Electron Mac应用程序,该应用程序允许用户单击一个代码段并将其粘贴到上次查看的应用程序(例如Mail等)中。

在不使用签名和沙箱的情况下为mas(Mac App Store)平台构建应用程序时,在 quasar.conf.js中使用以下设置

electron: {
packager: {
asar: false,
appBundleId: '[app id]',
platform: 'mas',
version: '1.0.0',
buildVersion: '4'
}
}

...以及以下构建命令:
quasar build -m electron

然后,当我双击生成的应用程序文件时,它运行良好。

但是,如果我对应用程序进行签名和沙盒化,则在 quasar.conf.js 中使用以下设置:
electron: {
packager: {
asar: false,
appBundleId: '[app id]',
osxSign: {
'entitlements': 'src-electron/default.entitlements.mas.plist'
},
platform: 'mas',
version: '1.0.0',
buildVersion: '4'
}
}

...使用此 default.entitlements.mas.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.network.client</key>
<true/>
</dict>
</plist>

...和相同的构建命令:
quasar build -m electron

然后,当我双击生成的应用程序文件时,它立即退出,并显示以下消息:

enter image description here

编辑:单击“报告”将显示以下消息:
PROCESS:               Email Snippets [90262]
Path: /Applications/MAMP/*/Email Snippets.app/Contents/MacOS/Email Snippets
Identifier: com.dannyconnell.emailsnippets
Version: ???
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Email Snippets [90262]
User ID: 501

Date/Time: 2018-11-03 21:14:01.171 +0000
OS Version: Mac OS X 10.13.6 (17G65)
Report Version: 12
Anonymous UUID: E00B5535-E6DC-B81E-1DCC-43B629EDC468

Sleep/Wake UUID: B3B79D2B-F30B-47B0-A980-0822EFC30745

Time Awake Since Boot: 90000 seconds
Time Since Wake: 480 seconds

System Integrity Protection: enabled

Crashed Thread: 0

Exception Type: EXC_CRASH (Code Signature Invalid)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Reason: Namespace CODESIGNING, Code 0x1

kernel messages:

VM Regions Near 0 (cr2):
-->
__TEXT 0000000103992000-0000000103993000 [ 4K] r-x/rwx SM=COW

Thread 0 Crashed:
0 ??? 0x000000011127d19c _dyld_start + 0

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000000 rcx: 0x0000000000000000 rdx: 0x0000000000000000
rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x0000000000000000 rsp: 0x00007ffeec26db20
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000000
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x000000011127d19c rfl: 0x0000000000000200 cr2: 0x0000000000000000

Logical CPU: 0
Error Code: 0x00000000
Trap Number: 0


Binary Images:
0x103992000 - 0x103992ff7 +??? (0) <447A1052-3F46-3E1B-BAC8-64F49EDE036E> (null)
0x11127c000 - 0x1112c6acf +??? (551.4) <8A72DE9C-A136-3506-AA02-4BA2B82DCAF3> (null)

External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 58409
thread_create: 0
thread_set_state: 54

VM Region Summary:
ReadOnly portion of Libraries: Total=432K resident=0K(0%) swapped_out_or_unallocated=432K(100%)
Writable regions: Total=8404K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=8404K(100%)

VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
STACK GUARD 56.0M 2
Stack 8192K 2
__DATA 228K 4
__LINKEDIT 128K 3
__TEXT 304K 3
shared memory 8K 3
=========== ======= =======
TOTAL 64.7M 11

Model: MacBookPro12,1, BootROM MBP121.0177.B00, 2 processors, Intel Core i5, 2.7 GHz, 8 GB, SMC 2.28f7
Graphics: Intel Iris Graphics 6100, Intel Iris Graphics 6100, Built-In
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1867 MHz, 0x80AD, 0x483943434E4E4E424C54414C41522D4E5544
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1867 MHz, 0x80AD, 0x483943434E4E4E424C54414C41522D4E5544
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x133), Broadcom BCM43xx 1.0 (7.77.37.31.1a9)
Bluetooth: Version 6.0.7f10, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM0256G, 251 GB
USB Device: USB 3.0 Bus
USB Device: Internal Memory Card Reader
USB Device: Bluetooth USB Host Controller
Thunderbolt Bus: MacBook Pro, Apple Inc., 27.1

如果然后我使用 electronic-osx-flat 打包应用程序:
electron-osx-flat "dist/electron-mat/[app name]-mas-x64/[app name].app" --verbose

..并双击pkg文件进行安装,然后该应用程序将成功安装。但是,当我单击“应用程序”中的应用程序时,它又立即退出,并显示上图中的消息。

编辑:另外,如果我在终端的.app文件中运行可执行文件,我只会得到以下消息:
Killed: 9

但是,当我将此生成的pkg文件提交进行审阅时,该应用程序基本上适用于审阅者,但是复制和粘贴功能不起作用。

我相信这与 default.entitlements.mas.plist 文件中缺少的权利有关。

但是,在提交到应用商店之前,我希望能够自己测试这些类型的问题。

将应用签名并沙箱化后,如何运行和测试我的应用?

最佳答案

感谢 @miadz 向我指出正确的方向。

这是将您的Electron应用程序完全沙箱化(在Apple Review团队中会看到并应用了所有权利的情况),您需要执行以下操作:

1)首先,您需要使用第二台Mac来测试您的应用

2)将第二台Mac作为列出的设备添加到Apple Developer网站(帐户> 证书,ID和配置文件> macOS > 设备> 所有)。您将需要Mac的UUID,您可以在苹果> 关于此Mac的菜单栏中找到> 概述> 系统报告...

3)在Apple Developer网站上为您的应用程序生成Mac Development Provisioning配置文件(帐户> 证书,ID和配置文件> macOS > Provisioning Profiles > 开发 2)作为设备。如果您已有开发配置文件,请对其进行编辑,然后在设备下选择第二台Mac。

4)下载您的配置文件并将其放在Quasar/Electron项目的根目录中

5)在开发Mac上,在没有签名的情况下为 mas 平台构建应用程序,例如

electron: {
packager: {
asar: false,
appBundleId: '[app id]',
platform: 'mas',
version: '1.0.0',
buildVersion: '4'
}
}

然后...
quasar build -m electron

6)使用 electronic-osx-sign 对生成的应用进行开发签名(您可能需要先使用npm install electron-osx-sign -g):
electron-osx-sign "dist/electron-mat/[app name]-mas-x64/[app name].app" --platform=mas --type=development --entitlements="src-electron/default.entitlements.mas.plist" --provisioning-profile="[app name]_Mac_Development.provisionprofile"

7)将生成的.app文件发送到第二台Mac并运行

关于macos - Electron/类星体-在签名和沙箱之后如何运行Mac应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53065535/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com