I am seeing problems with my intent handler showing up in my logs that I don't understand.
Here's the relevant code
func addAttendee(numberToAdd: Int) -> Int {
self.numberOfAttendees += numberToAdd
let intent = AddAttendeeIntent()
intent.suggestedInvocationPhrase = "Add People"
intent.people = NSNumber(value: numberToAdd)
let interaction = INInteraction(intent: intent, response: nil)
interaction.donate { (error) in
if error != nil {
if let error = error as NSError? {
self.logger.log("error occurred: \(error, privacy: .public)")
}
} else {
self.logger.log("Add people Intent success")
}
}
return (self.numberOfAttendees)
}
The error I am seeing is as follows:
error occurred: Error Domain=IntentsErrorDomain Code=1901 "Cannot donate interaction with intent that has no valid shortcut types: <INInteraction: 0x6000002b0480> {
intent = <INIntent: 0x6000014b0510> {
};
dateInterval = <_NSConcreteDateInterval: 0x600002670da0> (Start Date) 2023-03-05 01:30:08 +0000 + (Duration) 0.000000 seconds = (End Date) 2023-03-05 01:30:08 +0000;
intentResponse = <null>;
groupIdentifier = <null>;
intentHandlingStatus = Unspecified;
identifier = 8E92F53E-C532-4C3A-A58A-E30E2177A227;
direction = Unspecified;
} for intent <AddAttendeeIntent: 0x600001490090> {
people = 1;
}" UserInfo={NSLocalizedDescription=Cannot donate interaction with intent that has no valid shortcut types: <INInteraction: 0x6000002b0480> {
intent = <INIntent: 0x6000014b0510> {
};
dateInterval = <_NSConcreteDateInterval: 0x600002670da0> (Start Date) 2023-03-05 01:30:08 +0000 + (Duration) 0.000000 seconds = (End Date) 2023-03-05 01:30:08 +0000;
intentResponse = <null>;
groupIdentifier = <null>;
intentHandlingStatus = Unspecified;
identifier = 8E92F53E-C532-4C3A-A58A-E30E2177A227;
direction = Unspecified;
} for intent <AddAttendeeIntent: 0x600001490090> {
people = 1;
}}
Looking at my Intent definitions I should be ok:
And my intent handler is pretty simple too
override func handler(for intent: INIntent) -> Any {
// This is the default implementation. If you want different objects to handle different intents,
// you can override this and return the handler you want for that particular intent.
logger.log("\(intent)")
switch intent {
case is AddAttendeeIntent:
return AddAttendeeIntentHandler()
case is RemoveAttendeeIntent:
return RemoveAttendeeIntentHandler()
case is StartMeetingIntent:
return StartMeetingIntentHandler()
case is EndMeetingIntent:
return EndMeetingIntent()
case is ResetMeetingIntent:
return ResetMeetingIntent()
case is QuorumReachedIntent:
return QuorumReachedIntent()
default:
fatalError("Shortcut - No handler for this intent")
}
}
I am not sure what is meant by no valid shortcut type. If I change my Intent Handler to have a case of AddAttendee, it indicates that it does not exist. Any specific thing I am not seeing?