Siri Intent Dismiss callback issue

I am opening the Siri shortcut screen from the viewDidLoad method, as follows:

override func viewDidLoad() {
    super.viewDidLoad()
    
    // Present the Siri Shortcut screen to add Card Payment Intent
    let viewController = INUIAddVoiceShortcutViewController(shortcut: INShortcut(intent: self.cardPaymentIntent)!)
    viewController.modalPresentationStyle = .pageSheet
    // Setting Delegate
    viewController.delegate = self
    self.present(viewController, animated: true, completion: nil)
}

// Delegate Method Conformance :: INUIAddVoiceShortcutViewControllerDelegate

@available(iOS 12.0, *)
func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController, didFinishWith voiceShortcut: INVoiceShortcut?, error: Error?) {
    controller.dismiss(animated: true, completion: nil)
    // The issue is here. Whether we add the or Dismiss the Siri shortcut screen without adding it, this delegate gets called.
}

@available(iOS 12.0, *)
func addVoiceShortcutViewControllerDidCancel(_ controller: INUIAddVoiceShortcutViewController) {
    controller.dismiss(animated: true, completion: nil)
}

// Card Payment Intent

public var cardPaymentIntent: CardPaymentIntent {
        let intent = CardPaymentIntent()
        intent.suggestedInvocationPhrase = NSLocalizedString("Pay my credit card", comment: "")
        return intent
    }

Whenever I present the siri shortcut screen, either I add the shortcut or dismiss the screen without adding. In both cases , the shortcut is added. And this method is called every time

func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController, didFinishWith voiceShortcut: INVoiceShortcut?, error: Error?)

Any solution ? while I dismiss the screen, i want it not to be added into the shortcut

It seems like you've debugged this pretty far in your app. If you take the above code snippets and then put them in a test project, do you still see the shortcut created when canceling the sheet? If so, that test project would be a great addition to a bug report. If you happen to reproduce it again, please file a bug report and post the FB number here.

If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?

— Ed Ford,  DTS Engineer

Siri Intent Dismiss callback issue
 
 
Q