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)"]

        )

    }

}
Post not yet marked as solved Up vote post of F99 Down vote post of F99
3.8k views
  • Forgot to add: I expected the shortcut to be run after calling Siri on the simulator and saying "Show me my books on MyNewTestApp".

Add a Comment

Replies

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.

  • where do we call ShowMeMyBooks struct ??

  • where do we call this ShoeMeMyBooks struct??

Add a Comment

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.

  • Thanks for sharing this. I thought that Siri was not running my shortcut because it was misunderstanding my app name but this made me think differently.

Add a Comment

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 don't know what happened, but after 10 hours, Siri started to discover app intents.

  • THIS^^^^ although ten hours seems a bit much :) Thanks Arthur

    It is important to WAIT a few minutes, at least, before trying Siri. This is documented. Always wait after launching new build. Ten minutes maybe? Depends on memory available and things like that i imagine. HTH.

  • @oneeyedjack thanks for the info, could you point to where it is documented that you have to wait before trying Siri? Thanks

Add a Comment

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