App Shortcut "Couldn't find AppShortcutsProvider"

I am trying to create a shortcut following "Implement App Shortcuts With App Intents" talk from WWDC2022.

The below is my MWE. In a standalone app, this can be extended and behave like the video. Adding this code to my main app, makes the shortcut show up within the Shortcuts app, but if I click on it, it pops up an alert saying

Error Domain=LNActionForAutoShortcutPhraseFetchError Code=1 "Couldn't find AppShortcutsProvider" UserInfo={NSLocalizedDescription=Couldn't find AppShortcutsProvider}

My main app has several targets, so I suppose I need to establish which one is the shortcuts provider, but I cannot find any reference to how to do this in the documents.

Via Siri, the shortcut command is not recognised at all.

import AppIntents
import SwiftUI

struct DoSomething: AppIntent {
 static var title: LocalizedStringResource = "Do something"
 func perform() async throws -> some IntentResult {
  return .result()
 }
 static var openAppWhenRun: Bool = false
}

struct MyShortcuts: AppShortcutsProvider {
 @AppShortcutsBuilder
 static var appShortcuts: [AppShortcut] {
  AppShortcut(
   intent: DoSomething(),
   phrases: ["Do Something in \(.applicationName)"],
   systemImageName: "books.vertical.fill"
  )
 }
}

Is there any fix for this?

Is the problem solved?

Is there any method to solve this? I submitted feedback. (FB11291064)

And Is App Intents Extension is not recommended way?

Not only this issue, App Intents Extension way is hard to donate Intent, uses with SiriTipView. (Because in WWDC session, they suggest SHOULD NOT put App Intents codes in shared framework other than extension or main app.)

This is still broken in iOS 16 beta 7. The same shortcut works fine when implemented in the main app target instead of the app extension. FB11395308

I had experienced same problem. I guess the problem is rooted on an AppExtension target. I solved the problem by moving the file contains a concrete AppShortcutsProvider type to my host app target.

App Shortcut "Couldn't find AppShortcutsProvider"
 
 
Q