Incorrect Metadata.appintents with Xcode 14.3?

Recently (I think when updated to Xcode 14.3) my macOS Shortcut actions (implemented via AppIntent) started having a problem:

  • When I click an action's AppEntity parameter I see the following error instead of seeing a list of entries to select from.

The action “Demo Action” could not run because an internal error occurred.

One difference that I notice between my builds that didn't exhibit this error and my builds that do exhibit the error:

  • Working builds include objects.appintentsmanifest in the metadata folder
  • Builds that break with the above behavior do not include that file

Did something change in recent Xcode? What do I need to do so that Shortcuts app will run my queries again and provide popups so that I can select queried AppEnties?

To recreate the problem I created a new Document Based App in Xcode 14.3 and included the following code. I then dragged "Demo Action" into a new Shortcut and clicked "Show More" and then clicked "Books: Choose".

import AppIntents

struct BookEntity: Identifiable, AppEntity {
    var id: UUID
    
    @Property(title: "Title")
    var title: String
        
    var displayRepresentation: DisplayRepresentation {
        DisplayRepresentation(title: LocalizedStringResource(stringLiteral: title))
    }

    init(id: UUID, title: String?) {
        self.id = id
        self.title = title ?? "Unknown Title"
    }
    
    static var typeDisplayRepresentation: TypeDisplayRepresentation = "Book"
    static var defaultQuery = BookQuery()
}

struct BookQuery: EntityStringQuery {
    
    func entities(for identifiers: [UUID]) async throws -> [BookEntity] {
        library.filter { identifiers.contains($0.id) }
    }

    func entities(matching query: String) async throws -> [BookEntity] {
        library.filter { $0.title.localizedCaseInsensitiveContains(query) }
    }
     
    func suggestedEntities() async throws -> [BookEntity] {
        library
    }
}

struct DemoAction: AppIntent {
    static var title: LocalizedStringResource = "Demo Action"
    
    @Parameter(title: "Books")
    var books: [BookEntity]

    func perform() async throws -> some IntentResult {
        .result()
    }
}

let library: [BookEntity] = [
    BookEntity(id: UUID(), title: "The Hobbit"),
    BookEntity(id: UUID(), title: "The Lord of the Rings"),
]

Replies

I have verified that this problem does not happen on 14.2, but does happen on 14.3.

Here's a full demo project for testing:

https://github.com/jessegrosjean/AppIntentsDemo

Please let me know if you find a workaround for Xcode 14.3.

I have the same error "The action “Demo Action” could not run because an internal error occurred." in Xcode 15 beta 5. I resolved it by making a Multiplatform app template instead of a macOS.

Post not yet marked as solved Up vote reply of malc Down vote reply of malc
  • If I set the min deployment to macOS 14 then the shortcut will run. I can't run the app though because my version of macOS is 13.5.

Add a Comment

I had the same (or similar) problem in trying to build a simple app that uses AppIntents to create an App Shortcut -- the same error appearing when running the App Shortcut in macOS. I was using Xcode 14.3 on macOS 13.4. Setting aside the problem, I upgraded to macOS 13.5 (Xcode remaining at 14.3) and now, strangely enough, the App Shortcut began working as expected. I was building a Multiplatform app and the error never appeared when running in iOS.