Skip to content

AppIntentsPackage isn't recognized by iOS #24863

@tipa

Description

@tipa

Apple platform

iOS

Framework version

net10.0-*

Affected platform version

26.2.10197/10.0.100

Description

My goal is to use AppIntents in my app. More specifically, I need them to run in the context/process of my main app, so that I have access to my database when my apps run. According to this blog post this is possible by using ForegroundContinuableIntent and I was successful in replicating the behavior with a Swift project.

The project is structured as followed:

  • main app target "appintent"
  • widget target "widget"
  • shared framework target "shared"

You can find an example project incl. the Xcode and .NET project here: appintent.zip

The shared framework target contains the AppIntent definition "MyWidgetButtonIntent". It also contains the definition for my AppIntentsPackage, so I can ship my AppIntent via a shared framework.
This shared framework is used as a dependency for both my widget target and main app target. Those two targets also share an app group where I write some data for debugging purposes.
The widget target contains a button that should trigger the app intent and displays the data that is written in the app group user defaults by the app intent. It also sends a notification through the NotificationCenter. The main app process listens for that notification and when it receives one, it shows a notification - if this happens we know that the app intent ran in the foreground process/context.

Steps to Reproduce

  • Run the script run.sh -> the app will be deployed to the simulator
  • Grant the notification permission in-app
  • Create a widget and click the "Run Intent" button -> nothing happens
  • Open the Xcode project and deploy the main app from there, click the "Run Intent" button on the widget -> the widget now runs and a notification (triggered from within the Swift app) appears
  • Create a new shortcut in the Shortcut app and try to launch it -> works
  • Run the run.sh script again to redeploy the .NET app, click the "Run Intent" button on the widget -> still works, notification (triggered from within the .NET app) appears
  • Try to run the previously created Shortcut -> iOS shows error "The operation couldn't be completed. (WFActionErrorDomain error 16.)"

So essentially the .NET app doesn't seem to "register" the AppIntent or the AppIntent isn't discoverable by the system.
I was able to reproduce the same behavior by commenting out this code in the Swift app and then rebuild and deploy it:

struct AppIntentTestIntentsPackage: AppIntentsPackage {
    static var includedPackages: [any AppIntentsPackage.Type] {
        [SharedFrameworkIntentsPackage.self]
    }
}

That same code is in my AppIntent.swift file that I compile and include in my .NET app. For some reason, it doesn't seem to be recognized or processed by iOS

Did you find any workaround?

I have considered using the traditional AppIntent approach in which they run in their own process (or the process of the app extension). Apple recommends using an App Group for communication between extension and main app. However, this is not suitable for me since the logic in my AppIntent is based on a range of data that is stored in my main app database. And moving the database to the shared app folder isn't an option either since I would then have to duplicate my database access logic.

Relevant logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA feature to be implemented

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions