[iOS 15+] INIntent parameter resolving doesn't work

Hi there, I'm implementing a custom IntentHandler, which has a parameter. This parameter is an array of strings.

I'd like to handle the case when user didn't specify the value for this parameter. I want to provide a value calculated using my business logic and ask the user to confirm that value.

To do this, I use the resolveParameter function and return the following result:

[INStringResolutionResult.confirmationRequired(with: someSuggestedValue)]

Unfortunately, Siri throws an error with the message:

"Uh oh, there's a problem. Please try again."

using debug I caught the error, here's the error message:

libc++abi: terminating with uncaught exception of type NSException Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unexpected class Swift.__SwiftDeferredNSArray' terminating with uncaught exception of type NSException

Here's a part of my code.

func resolveParameter(for intent: MyCustomIntent) async -> [INStringResolutionResult] {
        if intent.arrayOfMyCustomParameters?.isEmpty ?? true {
            // Users did not specify the value
            intent.arrayOfMyCustomParameters = [someSuggestedValue]
            return [INStringResolutionResult.confirmationRequired(with: someSuggestedValue)]
        } else {
            var result = [INStringResolutionResult]()

            for value in intent.arrayOfMyCustomParameters {
                result.append(.success(with: value))
            }
            return result
        }
    }

p.s. This problem occurs only using the shortcut from the Siri voice assistant for iOS 15.0.0+ devices.

Not sure if this is helpful, but here is the stack trace.

libobjc.A.dylib`objc_exception_throw:
->  0x198f37670 <+0>:   stp    x28, x27, [sp, #-0x40]!
    0x198f37674 <+4>:   stp    x22, x21, [sp, #0x10]
    0x198f37678 <+8>:   stp    x20, x19, [sp, #0x20]
    0x198f3767c <+12>:  stp    x29, x30, [sp, #0x30]
    0x198f37680 <+16>:  add    x29, sp, #0x30            ; =0x30 
    0x198f37684 <+20>:  sub    sp, sp, #0xfc0            ; =0xfc0 
    0x198f37688 <+24>:  mov    x20, x0
    0x198f3768c <+28>:  mov    w0, #0x20
    0x198f37690 <+32>:  bl     0x19902ea70               ; __cxa_allocate_exception
    0x198f37694 <+36>:  mov    x19, x0
    0x198f37698 <+40>:  adrp   x8, 372380
    0x198f3769c <+44>:  ldr    x8, [x8, #0xb68]
    0x198f376a0 <+48>:  mov    x0, x20
    0x198f376a4 <+52>:  blr    x8
    0x198f376a8 <+56>:  mov    x20, x0
    0x198f376ac <+60>:  adrp   x8, 13442
    0x198f376b0 <+64>:  add    x1, x8, #0x959            ; =0x959 
    0x198f376b4 <+68>:  bl     0x198f24040               ; objc_msgSend
    0x198f376b8 <+72>:  str    x20, [x19]
    0x198f376bc <+76>:  adrp   x8, 342105
    0x198f376c0 <+80>:  add    x8, x8, #0x78             ; =0x78 
    0x198f376c4 <+84>:  add    x8, x8, #0x10             ; =0x10 
    0x198f376c8 <+88>:  mov    x21, x19
    0x198f376cc <+92>:  str    x8, [x21, #0x8]!
    0x198f376d0 <+96>:  mov    x0, x20
    0x198f376d4 <+100>: bl     0x198f37270               ; object_getClassName
    0x198f376d8 <+104>: str    x0, [x19, #0x10]
    0x198f376dc <+108>: cbnz   x20, 0x198f376e8          ; <+120>
    0x198f376e0 <+112>: mov    x8, #0x0
    0x198f376e4 <+116>: b      0x198f376f4               ; <+132>
    0x198f376e8 <+120>: tbnz   x20, #0x3f, 0x198f3779c   ; <+300>
    0x198f376ec <+124>: ldr    x8, [x20]
    0x198f376f0 <+128>: and    x8, x8, #0xffffffff8
    0x198f376f4 <+132>: str    x8, [x19, #0x18]
    0x198f376f8 <+136>: adrp   x22, 377914
    0x198f376fc <+140>: ldrb   w8, [x22, #0x2c6]
    0x198f37700 <+144>: cbz    w8, 0x198f37720           ; <+176>
    0x198f37704 <+148>: mov    x0, x20
    0x198f37708 <+152>: bl     0x198f37270               ; object_getClassName
    0x198f3770c <+156>: stp    x20, x0, [sp, #0x8]
    0x198f37710 <+160>: str    x19, [sp]
    0x198f37714 <+164>: adrp   x0, 28
    0x198f37718 <+168>: add    x0, x0, #0xae9            ; =0xae9 
    0x198f3771c <+172>: bl     0x198f4957c               ; _objc_inform
    0x198f37720 <+176>: adrp   x8, 377914
    0x198f37724 <+180>: ldrb   w8, [x8, #0x2c7]
    0x198f37728 <+184>: cbz    w8, 0x198f37780           ; <+272>
    0x198f3772c <+188>: ldrb   w8, [x22, #0x2c6]
    0x198f37730 <+192>: cbnz   w8, 0x198f37750           ; <+224>
    0x198f37734 <+196>: mov    x0, x20
    0x198f37738 <+200>: bl     0x198f37270               ; object_getClassName
    0x198f3773c <+204>: stp    x20, x0, [sp, #0x8]
    0x198f37740 <+208>: str    x19, [sp]
    0x198f37744 <+212>: adrp   x0, 28
    0x198f37748 <+216>: add    x0, x0, #0xae9            ; =0xae9 
    0x198f3774c <+220>: bl     0x198f4957c               ; _objc_inform
    0x198f37750 <+224>: add    x0, sp, #0x20             ; =0x20 
    0x198f37754 <+228>: mov    w1, #0x1f4
    0x198f37758 <+232>: bl     0x1941a3b34
    0x198f3775c <+236>: mov    x22, x0
    0x198f37760 <+240>: adrp   x8, 342104
    0x198f37764 <+244>: ldr    x8, [x8, #0xd18]
    0x198f37768 <+248>: ldr    x0, [x8]
    0x198f3776c <+252>: bl     0x1941a3df8
    0x198f37770 <+256>: mov    x2, x0
    0x198f37774 <+260>: add    x0, sp, #0x20             ; =0x20 
    0x198f37778 <+264>: mov    x1, x22
    0x198f3777c <+268>: bl     0x198f4a8cc               ; symbol stub for: backtrace_symbols_fd
    0x198f37780 <+272>: mov    x0, x20
    0x198f37784 <+276>: nop    
    0x198f37788 <+280>: adrp   x2, 3
    0x198f3778c <+284>: add    x2, x2, #0xac0            ; =0xac0 
    0x198f37790 <+288>: mov    x0, x19
    0x198f37794 <+292>: mov    x1, x21
    0x198f37798 <+296>: bl     0x198f4a7d0               ; symbol stub for: __cxa_throw
    0x198f3779c <+300>: adrp   x8, 372380
    0x198f377a0 <+304>: add    x8, x8, #0xae0            ; =0xae0 
    0x198f377a4 <+308>: and    x9, x20, #0x7
    0x198f377a8 <+312>: ldr    x8, [x8, x9, lsl #3]
    0x198f377ac <+316>: adrp   x9, 372380
    0x198f377b0 <+320>: add    x9, x9, #0x258            ; =0x258 
    0x198f377b4 <+324>: cmp    x8, x9
    0x198f377b8 <+328>: b.ne   0x198f376f4               ; <+132>
    0x198f377bc <+332>: ubfx   x8, x20, #55, #8
    0x198f377c0 <+336>: adrp   x9, 372380
    0x198f377c4 <+340>: add    x9, x9, #0x2e0            ; =0x2e0 
    0x198f377c8 <+344>: ldr    x8, [x9, x8, lsl #3]
    0x198f377cc <+348>: b      0x198f376f4               ; <+132>
    0x198f377d0 <+352>: udf    #0x0
    0x198f377d4 <+356>: udf    #0x0
[iOS 15+] INIntent parameter resolving doesn't work
 
 
Q