API Misue crash in Xcode 13.0, ios 15 and 14.5 when running AVFoundation, simulator only

Having a problem when I am running AVFoundation SDAVAssetExportSession.exportAsynchronously code in Xcode 13 on the Simulator, running either iOS 15 or iOS 14.5.

This is code that has worked on every version of Xcode and Simulator (iOS 11.0+) for the last 5 years. This code still works on my device running iOS 14.8.

However, after upgrading to Xcode 13, I am getting this problem of API Misuse when running AVFoundation SDAVAssetExportSession.exportAsynchronously. This is code that has worked for years without change. How can i fix this, or is this a bug in Xcode 13?

0x1084c7b45 <+81>:  movl   $0xa0, %esi
0x1084c7b4a <+86>:  movq   %rbx, %rdi
0x1084c7b4d <+89>:  xorl   %eax, %eax
0x1084c7b4f <+91>:  callq  0x1084d48dc               ; symbol stub for: snprintf
0x1084c7b54 <+96>:  movq   %rbx, 0x2196d(%rip)       ; gCRAnnotations + 8
0x1084c7b5b <+103>: leaq   0x112f9(%rip), %rax       ; "API Misuse"
0x1084c7b62 <+110>: movq   %rax, 0x21967(%rip)       ; gCRAnnotations + 16
->  0x1084c7b69 <+117>: ud2    

happening in xcode 13.1 as well

and happening in xcode 12.5

It's not clear what's happening. Is your app crashing? If so, please post a full crash log. Either way, if this used to work but no longer works, it's worth filing a report using the feedback assistant.

I am not getting any stack trace when the crash occurs. I only get a dump from the thread, which appears to be assembly or some instruction set. I'll paste that in full here.

libxpc.dylib`_xpc_api_misuse:
    0x111774af4 <+0>:   pushq  %rbp
    0x111774af5 <+1>:   movq   %rsp, %rbp
    0x111774af8 <+4>:   pushq  %rbx
    0x111774af9 <+5>:   subq   $0xa8, %rsp
    0x111774b00 <+12>:  movq   %rdi, %rcx
    0x111774b03 <+15>:  movaps 0xd9f6(%rip), %xmm0       ; __xpcVersionNumber + 16
    0x111774b0a <+22>:  leaq   -0xb0(%rbp), %rbx
    0x111774b11 <+29>:  movaps %xmm0, 0x90(%rbx)
    0x111774b18 <+36>:  movaps %xmm0, 0x80(%rbx)
    0x111774b1f <+43>:  movaps %xmm0, 0x70(%rbx)
    0x111774b23 <+47>:  movaps %xmm0, 0x60(%rbx)
    0x111774b27 <+51>:  movaps %xmm0, 0x50(%rbx)
    0x111774b2b <+55>:  movaps %xmm0, 0x40(%rbx)
    0x111774b2f <+59>:  movaps %xmm0, 0x30(%rbx)
    0x111774b33 <+63>:  movaps %xmm0, 0x20(%rbx)
    0x111774b37 <+67>:  movaps %xmm0, 0x10(%rbx)
    0x111774b3b <+71>:  movaps %xmm0, (%rbx)
    0x111774b3e <+74>:  leaq   0x11303(%rip), %rdx       ; "XPC API Misuse: %s"
    0x111774b45 <+81>:  movl   $0xa0, %esi
    0x111774b4a <+86>:  movq   %rbx, %rdi
    0x111774b4d <+89>:  xorl   %eax, %eax
    0x111774b4f <+91>:  callq  0x1117818dc               ; symbol stub for: snprintf
    0x111774b54 <+96>:  movq   %rbx, 0x2196d(%rip)       ; gCRAnnotations + 8
    0x111774b5b <+103>: leaq   0x112f9(%rip), %rax       ; "API Misuse"
    0x111774b62 <+110>: movq   %rax, 0x21967(%rip)       ; gCRAnnotations + 16
->  0x111774b69 <+117>: ud2    

Simulator logs,, CoreSimulator logs etc are all empty. There are no useful logs to post, as far as I can tell. Even with debugger, it crashes somewhere inside the exportAsynchronously function. Nothing useful comes from trying to step into it with the debugger either.

It looks like it is XPC that is being misused, so in the absence of more context you may have better luck in that section of the forums.

API Misue crash in Xcode 13.0, ios 15 and 14.5 when running AVFoundation, simulator only
 
 
Q