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?