I want to use Siri to perform a repetitive task in my app that inputs variable parameters, thus accelerating the input of that data.
I have implemented a couple custom intents for background execution with the use of an intentDefinition file and implemented an IntentsExtension and associated plist to enable those custom intents. I can successfully donate an interaction that iOS matches with the supported suggestions in the intentsDefinition file that causes a Siri Suggestion to be displayed in Siri Search (or on the lock screen when enabled):
CreatePartsListIntent* createPartsListIntent = [[CreatePartsListIntent alloc] init];
createPartsListIntent.projectName = intentData.projectName;
createPartsListIntent.quantity = intentData.quantity;
INInteraction* interaction = [[INInteraction alloc] initWithIntent:createPartsListIntent response:nil];
[interaction donateInteractionWithCompletion:^(NSError * _Nullable error) {
if(!error) {
NSLog(@"CreatePartsList donation success");
}else {
NSLog(@"CreatePartsList donation fail %@",error.localizedDescription);
}
}];
I can then tap on this suggestion and it takes me to my appDelegate to process the interaction within the app
- (id)application:(UIApplication *)application handlerForIntent:(INIntent *)intent {
// This method is called when I tap on the Siri suggestion
}
But I want to process the interaction in the background using voice commands. When I speak the the command of the interaction I donated, the IntentHandler is never called. I cannot figure out what I need to do to get the IntentHandler to be called. According to the WWDC18 Intro to Siri Shortcuts, I should be able to invoke a dialog with Siri, which is my goal.
Am I off track. Why isn't the IntentHandler being called? What should trigger it to be called?