iOS 17.2 breaking AppIntents and shortcuts

I have an app that relies heavily on AppIntents and Shortcuts and it seems like the latest iOS update broke those but I can't quite figure out what's the issue. The is that no matter what parameter I pick, when running the shortcut it always uses the defaultResult()

Here's an example AppEntity:

struct IntentBrokerAppEntity: AppEntity {
    static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Intent Broker")

    @Property(title: "Name")
    var name: String?

    @Property(title: "Ip")
    var ip: String?

    @Property(title: "Port")
    var port: String?

    @Property(title: "Username")
    var username: String?

    @Property(title: "Password")
    var password: String?

    @Property(title: "Tls")
    var tls: Bool?

    struct IntentBrokerAppEntityQuery: EntityQuery {
        func entities(for identifiers: [IntentBrokerAppEntity.ID]) async throws -> [IntentBrokerAppEntity] {
            return try await suggestedEntities().filter { identifiers.contains($0.id) }
        }

        func suggestedEntities() async throws -> [IntentBrokerAppEntity] {
            let context = PersistenceController.shared.viewContext
            let brokerService = BrokerService(context: context)
            return brokerService.getFavorites().map { IntentBrokerAppEntity(broker: $0) }
        }
        
        func defaultResult() async -> IntentBrokerAppEntity? {
            try? await suggestedEntities().first
        }
    }
    static var defaultQuery = IntentBrokerAppEntityQuery()

    var id: String // if your identifier is not a String, conform the entity to EntityIdentifierConvertible.
    var displayString: String
    var displayRepresentation: DisplayRepresentation {
        DisplayRepresentation(title: "\(displayString)")
    }
...

This used to work perfectly fine before 17.2, but now instead of choosing the entity the user picked it always falls back to defaultEntity().

In the console I get this warning

Failed to build EntityIdentifier. IntentBrokerAppEntity is not a registered AppEntity identifier

But I'm not sure if that's related. Does anyone have any ideas on what's going on here? Input much appreciated!

Post not yet marked as solved Up vote post of Lucakaufmann Down vote post of Lucakaufmann
737 views
  • This is happening to me as well -- I just submitted FB13474182 to track it.

Add a Comment

Replies

This is also happening in my app!

  • In my case, my app entity was declared twice under the same name: once in my main app target and once in my app intents extension, where I used it for a focus filter.

    I resolved the issue by renaming my app entity in the app intents extension. It appears there was a conflict between the two entities sharing the same name beginning with iOS 17.2; this was not an issue prior to that.

Add a Comment

Hey! I am facing this exact issue too! Have you managed to find a fix?