2

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

当我在没有签名和沙盒的情况下为 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

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

在此处输入图像描述

编辑:单击报告显示以下消息:

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

如果我然后使用electron-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文件中缺少的权利有关。

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

签名和沙盒化后,如何运行和测试我的应用程序?

4

1 回答 1

2

感谢@miadz为我指明了正确的方向。

以下是运行完全沙盒化的 Electron 应用程序所需的操作(在 Apple 审核团队看来,应用了所有权利):

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

2) 将您的第二台 Mac 添加为 Apple 开发者网站上列出的设备(Account > Certificates, IDs and Profiles > macOS > Devices > all)。您将需要 Mac 的 UUID,您可以从Apple > About This Mac > Overview > System Report...的菜单栏中找到它。

3) 在 Apple Developer 网站上为您的应用程序生成 Mac Development Provisioning 配置文件(Account > Certificates, IDs and Profiles > macOS > Provisioning Profiles > Development),并确保选择您的第二台 Mac 作为设备。如果您已经有一个开发配置文件,请编辑它并在Devices下选择您的第二台 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) 使用electron-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 并运行

于 2018-11-07T11:44:18.253 回答