1

I'm changing an App Intent definition, but the changes are not reflected in the Shortcuts app when I try to use my changed intent as an action in a Shortcut.

And trying to run the shortcut gives an exception:

[Execution] perform() returned types not declared in method signature

AppIntents/PerformActionExecutorTask.swift:78: Fatal error: perform() returned types not declared in method signature

Is there a way to force reload the Shortcuts app to get the new intents or am I missing something more basic?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
hungrxyz
  • 745
  • 11
  • 20

1 Answers1

2

I figured it out. When returning a result together with a value the return definition of the perform() function needs to include IntentResult like so:

// Works as described ✅
func perform() async throws -> some IntentResult & ReturnsValue<String> {
    return .result(value: "Some text")
}

Including just ReturnsValue<String> will result in the exception above and modified version of the intent will not be picked up by the compiler.

// Incorrect function annotation ❌
func perform() async throws -> some ReturnsValue<String> {
    return .result(value: "Some text")
}
hungrxyz
  • 745
  • 11
  • 20