I'm not really sure if I'm using the right lingo here because there's so little documentation on this, so apologies in advance.
I have an app with a few custom intents that I'm attempting to transition to AppIntents. I have the newly transitioned intents showing up in the Shortcuts app as expected, however when I run them I get an immediate failure saying "The operation couldn't be completed" (see photo). Note that the "AppIntentsClient" class mentioned in the photo is the dependency I'm trying to import.
I've narrowed it down to the @Dependency that I'm using in my intent handler. At the top of the intent handler I have a line:
@Dependency
private var appIntentsClient: any AppIntentsClient // NOTE: AppIntentsClient is a protocol -- could that be the issue?
And if I comment out this line, the intent no longer throws that error.
I'm following the guidelines shown in sample apps by setting the dependency on my main app's startup in didFinishLaunchingWithOptions
like so:
// gets called by the main app `didFinishLaunchingWithOptions`
func onDidFinishLaunching() {
let adapter = AppIntentsAdapter() //AppIntentsAdapter adheres to protocol AppIntentsClient
self.appIntentsAdapter = adapter
AppDependencyManager.shared.add(dependency: adapter)
MyAppShortcuts.updateAppShortcutParameters()
}
Unfortunately there is virtually no documentation around AppDependencyManager or AppDependencies in general. Both documentation pages have at most one line, but don't indicate why this would be failing for me. Is there any information out there on why these errors may be happening? I've also looked at the Console app to see if the OS logs anything, but nothing of value was found.
https://developer.apple.com/documentation/appintents/appdependencymanager
https://developer.apple.com/documentation/appintents/appdependency