I'm trying to figure out how to define and create shortcuts using the Custom Intents in iOS12. I want to create a shortcut so that a user can add a task to my app and give it a name (and other parameters in the future). For e.g. just say to Siri "Add Task with name 'Pick up laundry'".
Here is how I've defined the intent:

Then I am trying to create a Siri shortcut using this:
TaskIntent *taskIntent = [[TaskIntent alloc] init];
taskIntent.suggestedInvocationPhrase = @"TaskIt";
INShortcut *taskShortcut = [[INShortcut alloc] initWithIntent:taskIntent];
INUIAddVoiceShortcutViewController *addSiri = [[INUIAddVoiceShortcutViewController alloc] initWithShortcut:taskShortcut];
addSiri.delegate = self;
[self presentViewController:addSiri animated:YES completion: nil];
However, it ends up with an exception in the app:
Cannot create shortcut from intent ( { taskName = ; identifier = EE4661C6-1826-4A14-84EC-FD684647FE2B; }) because it has no valid parameter combinations
So I'm not sure how to do this correctly. Do I have to give a taskName when donating the shortcut? But that will mean the same taskName is shown and added to the system each time, which is not what I want. Or is the new SiriKit not customizable enough to handle generic input?
Yes, after having created your custom
TaskIntent, you need to populate its parameters. That is, you need to set a value fortaskName:You donate the intent every time the user does the related action in your app. If your user enters a task with a
taskName, you can donate this taskName by creating your intent and setting thetaskIntent.taskNameparameter to the task name your user put in. It will suggest a shortcut for entering a task with the same title again, which is probably not what you want. Adding tasks is not repetitive due to different task titles and nothing which can be predicted, so theINAddTasksIntentseems to be a better fit than donating shortcuts.