Search code examples
swiftxcodemacosmac-catalystnspersistentcloudkitcontainer

Mac catalyst with NSPersistentCloudKitContainer crash: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)


My app uses NSPersistentCloudKitContainer and it works just fine on iPhone and iPad. Once I ported it to Mac (Catalyst), I started experiencing a EXC BAD INSTRUCTION crash and I can't to wrap my head around it.

I decided to port to MacOS Apple's NSPersistentCloudKitContainer demo project from WWDC 2019 using Catalyst and I'm experiencing the same crash.

I also tried starting a new simple project that I ported to MacOS using Catalyst and it doesn't crash. So, my guess is that the problem is related to the new NSPersistentCloudKitContainer..

Anybody experiencing the same crash? Any guidance would be appreciated.

Here is the crash log:

libxpc.dylib`___xpc_activity_dispatch_block_invoke.107.cold.3:
    0x7fff63df530b <+0>:  pushq  %rbp
    0x7fff63df530c <+1>:  movq   %rsp, %rbp
    0x7fff63df530f <+4>:  xorl   %edi, %edi
    0x7fff63df5311 <+6>:  callq  0x7fff63df53c0            ; symbol stub for: _os_assert_log
    0x7fff63df5316 <+11>: movq   %rax, %rdi
    0x7fff63df5319 <+14>: callq  0x7fff63df53d2            ; symbol stub for: _os_crash
->  0x7fff63df531e <+19>: ud2    

Solution

  • I finally was given a fix by Apple support. The issue lied in having revoked certificates in my keychain. So, go to your keychain, and look up all your apple certificates. Upon selecting them you'll notice that they either valid (green checkmark) or revoked (red circled cross). Get rid of all of your revoked certificates, but make sure that they exist in their valid form before doing that. In my case, all the revoked certificates were duplicates of valid certificates.