mac Catalyst, EXC_CRASH (Code Signature Invalid), Xcode 12.1

I'm trying to convert iOS application with support for iPhones and iPads to a mac Catalyst enabled application. I was able to build it successfully, but I'm unable to run it.
It crashes every time with the following error retrieved from Console.
Code Block Date/Time: 2020-11-03 18:12:03.568 +0100
OS Version: Mac OS X 10.15.7 (19H2)
Report Version: 12
Bridge OS Version: 4.6 (17P6610)
Anonymous UUID: 3228F646-0337-CCB2-D4B3-41A73C8D5C68
Sleep/Wake UUID: F1A5472C-EBEC-4CBC-8FEA-8EE8257398D2
Time Awake Since Boot: 78000 seconds
Time Since Wake: 1400 seconds
System Integrity Protection: enabled
Crashed Thread: 0
Exception Type: EXC_CRASH (Code Signature Invalid)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
kernel messages:
VM Regions Near 0 (cr2):
-->
TEXT 0000000100000000-0000000100038000 [ 224K] r-x/r-x SM=COW
Thread 0 Crashed:
0 ??? 0x0000000100079000 _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: 0x00007ffeefbff368
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000000
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x0000000100079000 rfl: 0x0000000000000200 cr2: 0x0000000000000000
Logical CPU: 0
Error Code: 0x00000000
Trap Number: 0
Binary Images:
0x100000000 - 0x100037fff +??? (0) <F1126CDD-A67C-3FAA-8727-863815CDC5D7> (null)
0x100078000 - 0x100109f47 +??? (750.6) <1D318D60-C9B0-3511-BE9C-82AFD2EF930D> (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: 174379
thread_create: 0
thread_set_state: 195
VM Region Summary:
ReadOnly portion of Libraries: Total=1196K resident=0K(0%) swapped_out_or_unallocated=1196K(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 1
Stack 8192K 1
DATA 248K 3
DATA_CONST 52K 2
LINKEDIT 416K 3
__TEXT 808K 2
shared memory 8K 2
=========== ======= =======
TOTAL 65.5M 14


I've verified that the provisioning profile is valid and App ID contains Catalyst. The app embeds packet tunnel extension which has its own target. Signing for both targets is managed manually.
Can someone help me shed light on the cause of this crash? I asked other experienced mac devs in my company but they don't understand it either.
Probably like this are most commonly caused by an entitlement / provisioning profile mismatch. Dump your app’s entitlements and the entitlement allowlist in the profile and make sure that every entitlement is in that allowlist.

To dump the app’s entitlements:

Code Block
% codesign -d --entitlements :- /path/to/your.app


To dump the profile:

Code Block
% security cms -D -i /path/to/your.app/Contents/embedded.provisionprofile


Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Thanks for the reply. I found out that our app was missing com.apple.developer.networking.HotspotHelper entitlement in the app provisioning profile. The same entitlement in a network extension doesn't cause the app to crash.
The problem is, I can't generate mac Catalyst profile with this entitlement because I don't see this option in the developer portal. It works for iOS provisioning profiles with the same App ID (the iOS version is already released with this entitlement).
Is HotspotHelper entitlement granted per platform or is there any other way how to use it with mac Catalyst?

Is HotspotHelper entitlement granted per platform

Yes.

Keep in mind that the com.apple.developer.networking.HotspotHelper entitlement enables access to NEHotspotHelper and that’s an iOS-only feature. You don’t need this entitlement on macOS because it doesn’t enable anything on that platform.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
mac Catalyst, EXC_CRASH (Code Signature Invalid), Xcode 12.1
 
 
Q