App Intent not Discoverable by Siri

I'm implementing the iOS 16 AppIntents framework and it works fine except when I try to trigger it with Siri, which just pulls up results from the web. Here's a very simple version I made on an empty project.

import Foundation

import AppIntents



@available(iOS 16.0, *)

struct ShowMeBooks: AppIntent {

    static var openAppWhenRun: Bool = false

    static var title: LocalizedStringResource = "Show me my books"

    

    func perform() async throws -> some IntentPerformResult {

        let x = 1 + 1

        return .finished(dialog: "Here are your books")

    }

}



@available(iOS 16.0, *)

struct SouthwestShortcuts: AppShortcutsProvider {

    static var appShortcuts: [AppShortcut] {

        AppShortcut(

            intent: ShowMeBooks(),

            phrases: ["Show me my books on \(.applicationName)"]

        )

    }

}

Forgot to add: I expected the shortcut to be run after calling Siri on the simulator and saying "Show me my books on MyNewTestApp".

Accepted Answer

just say "Show me my books". don't need your app name.

Also it seems you don't need the AppShortcutsProvider. I was able to get it working with just the AppIntent struct

struct ShowMeMyBooks: AppIntent {
    static var title: LocalizedStringResource = "Show me my books"

    @MainActor
    func perform() async throws -> some IntentResult {
        return .result(dialog: "These are your books")
    }
    static var openAppWhenRun: Bool = false
}

note: it seems the sample code in the WWDC session is wrong. its right in the video but not in the attached code.

I updated to Xcode 14.0 Beta 3 and my code didn't compile anymore so I had to change .finished to .result and add @MainActor like yours. I tried your code and Siri worked once...I couldn't recreate it even after deleting all contents and settings. I guess it's just Xcode being funky so I'll give it some time. Thank you.

I'm also still having the same experience, in Xcode beta 4/iOS 16 beta 4 - the intent works fine through the shortcuts app, but my key phrases are totally ignored by Siri, even when typed EXACTLY as they are defined.

Hello, did you resolve this problem? Because I have the same issues. Here my code:

Intent.swift

struct Intent: AppIntent {
    static var title: LocalizedStringResource = "Perform Intent"

    static var openAppWhenRun: Bool = false

    @MainActor
    func perform() async throws -> some IntentResult {
        return .result(dialog: "Hello World")
    }
}
IntentExtension.swift 

@main
struct IntentExtension: AppIntentsExtension {
}

struct Shortcuts: AppShortcutsProvider {
    static var appShortcuts: [AppShortcut] {
        AppShortcut(intent: Intent(), phrases: ["Perform intent"])
    }
}


Probably for the recognition phase need to pass Shortcuts struct to IntentExtension but I don't understand how I can do it

I have the same issue. Is it a bug of Xcode beta, or our implement?

This issue is still here in Xcode 14 RC. Do you guys know how to fix it?

Hi, this is a known bug and should be fixed soon.

Spoiler alert: it wasn't fixed soon.

Still manifesting with Xcode 14.2 and Ventura 13.1

App Intent not Discoverable by Siri
 
 
Q