Hello,
I’m working on integrating SiriKit with my music app using INPlayMediaIntent. My app is live on TestFlight, and the Siri command is being recognized, but mediaItems is always empty in my Intent
Demo Project
Intents
RSS for tagShare intents from within an app to drive system intelligence and show the app's actions in the Shortcuts app.
Posts under Intents tag
103 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I'm making an app that can have locations and links shared to it. I have gotten the share intent working for text and urls with:
NSExtensionActivationSupportsWebURLWithMaxCount: 1
NSExtensionActivationSupportsWebPageWithMaxCount: 1
NSExtensionActivationSupportsText: true
in Info.plist of the share extension. I am able to share Google Maps locations and safari websites. However, my app does not appear when I share a location on Apple Maps.
I also tried the other options in the docs (https://developer.apple.com/documentation/bundleresources/information-property-list/nsextension/nsextensionattributes/nsextensionactivationrule) as well without success. When I share a location (i.e. a shop) in Apple Maps, it looks like a link but perhaps its something else?
Does anyone know how to get an app to come up in the share menu of an Apple Maps location?
Thanks!
Hi,
we're having trouble implementing search through Siri voice commands.
We already did it successfully for audio playback using INPlayMediaIntentHandling.
For search, none of the available ways works.
Both INSearchForMediaIntentHandling and ShowInAppSearchResultsIntent never open the App in the first place. We tried various commands, but e.g. "Search for " sometimes opens the Apple Music app and sometimes shows a Google search widget. Our app is never taken into consideration for providing any results.
We implemented all steps mentioned in WWDC videos and documentation (e.g. https://developer.apple.com/documentation/appintents/making-in-app-search-actions-available-to-siri-and-apple-intelligence), but nothing seems to work.
We're mainly testing on iOS 18 currently. Any idea why this is not working?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
SiriKit
Intents
App Intents
Hello! I'm facing a strange behavior on macOS related to Ask Each Time, which works fine on iOS. I've an App Intent that declares a parameter like so:
@Parameter(
title: "Tags",
description: "Tags to add to the link.",
optionsProvider: TagsOptionsProvider()
)
var tags: [String]?
The TagsOptionProvider is like this:
struct TagsOptionsProvider: DynamicOptionsProvider {
@Dependency
private var modelCoordinator: ModelCoordinator
@MainActor
func results() async throws -> [String] {
return modelCoordinator.tags().compactMap { $0.name }
}
}
Now, the issue comes if I create a shortcut where for the tags parameter the user selects the magic variable Ask Each Time. On iOS, when the user is presented with the selector, they can simply tap 'Done' without selecting any value (the user does not want to include any tag). The problem is that on macOS the 'Done' button is disabled if there's no selection. See both behaviors:
iOS:
macOS:
Question:
Is there a way to let macOS continue even if the user doesn't select any of the available options like on iOS? I've tried declaring the tags para meter as Optional (like on the screenshot) and non-optional, both cases show the same behavior.
Environment:
iOS 18.5
macOS 15.5
When we use the "Find All Reminders" shortcut, there's these two filters "Is Completed and "Is Not Completed".
When I implement this in my app, the best I could get is just "Completed" and "Not Completed", I can't figure out how to add the "Is" in front.
In my entity:
@Property(title: "Completed")
var completed : Bool
In the EntityPropertyQuery:
static var properties = QueryProperties {
Property(\GTDItemAppEntity.$list) {
EqualToComparator { NSPredicate(format: "list.uuid = %@", $0.id as NSUUID) }
}
Property(\GTDItemAppEntity.$text) {
ContainsComparator { NSPredicate(format: "text CONTAINS[cd] %@", $0) }
EqualToComparator { NSPredicate(format: "text = %@", $0) }
}
Property(\GTDItemAppEntity.$completed) {
EqualToComparator { NSPredicate(format: $0 ? "completed = YES" : "completed = NO") }
}
}
If I change the property to
@Property(title: "Is Completed")
var completed : Bool
Then it will show as "Is Completed" and "Not Is Completed" in the filter!
Reminder:
My App:
I'm currently working on enhancing our app’s support for App Intents. We're aiming to suggest time-sensitive shortcuts to Spotlight and Siri — for example, proactively surfacing certain shortcut from 2 hours before some event the user has registered in their database until 2 hour after that.
I’ve been reviewing the AppIntents framework documentation but haven’t found a definitive answer on whether this is currently achievable.
From what we understand, the RelevantIntent and RelevantContext APIs appear to support time-based suggestions, but they seem to apply only to Widgets, not to standalone app shortcuts. Is this understanding correct, and is there a recommended approach for achieving time-sensitive shortcut suggestions outside of a Widget context?
Any guidance would be greatly appreciated.
Best regards,
Hello!
I am excited to try out the new continueInForeground API with iOS 26.
I was wondering, what is the suggested way to transport meta data to the main app?
Before, with SiriKit intents I would use the .onContinueUserActivity() API and were able to pass a NSUserActivity from the Shortcut to the Main app.
Now, with the continueInForeground() call I am not sure – what would be your suggestion?
Of course, I can store some data in UserDefaults, but that feels like a workaround.
Happy to get some input on this!
Thanks a lot and have a great day!
I'm trying to create two widgets, widget A and B.
Currently A and B are very similar so they share the same Intent and Intent Timeline Provider.
I use the Intent Configuration interface to set a parameter, in this example lets say its the background tint.
On one of the widgets, widget A, I want to also set another String enum parameter (for a timescale), but I don't want this option to be there for widget B as it's not relevant.
I'm aware of some of the options for configuring the ParameterSummary, but none that let me pass in or inject the "kind" string (or widget ID) of the widget that's being modified.
I'll try to provide some code for examples.
My Widget Definition (targeting >= iOS 17)
struct WidgetA: Widget {
// I'd like to access this parameter within the intent
let kind: String = "WidgetA"
var body: some WidgetConfiguration {
AppIntentConfiguration(kind: kind, intent: WidgetIntent.self, provider: IntentTimelineProvider()) { entry in
WidgetView(data: entry)
}
.configurationDisplayName("Widget A")
.description("A widget.")
.supportedFamilies([.systemMedium, .systemLarge])
}
}
struct WidgetB: Widget {
let kind: String = "WidgetB"
var body: some WidgetConfiguration {
AppIntentConfiguration(kind: kind, intent: WidgetIntent.self, provider: IntentTimelineProvider()) { entry in
WidgetView(data: entry)
}
.configurationDisplayName("Widget B")
.description("B widget.")
.supportedFamilies([.systemMedium, .systemLarge])
}
}
struct IntentTimelineProvider: AppIntentTimelineProvider {
typealias Entry = WidgetIntentTimelineEntry
typealias Intent = WidgetIntent
........
}
struct WidgetIntent: AppIntent, WidgetConfigurationIntent {
// This intent allows configuration of the widget background
// This intent also allows for the widget to display interactive buttons for changing the Trend Type
static var title: LocalizedStringResource = "Widget Configuration"
static var description = IntentDescription("Description.")
static var isDiscoverable: Bool { return false}
init() {}
init(trend:String) {
self.trend = trend
}
// Used for implementing interactive Widget
func perform() async throws -> some IntentResult {
print("WidgetIntent perform \(trend)")
#if os(iOS)
WidgetState.setState(type: trend)
#endif
return .result()
}
@Parameter(title: "Trend Type", default: "Trend")
var trend:String
// I only want to show this parameter for Widget A and not Widget B
@Parameter(title: "Trend Timescale", default: .week)
var timescale: TimescaleTypeAppEnum?
@Parameter(title: "Background Tint", default: BackgroundTintTypeAppEnum.none)
var backgroundTint: BackgroundTintTypeAppEnum?
static var parameterSummary: some ParameterSummary {
// Summary("Test Info") {
// \.$timescale
// \.$backgroundTint
// }
// An example of a configurable widget parameter summary, but not based of kind/ID string
When(\.$backgroundTint, .equalTo, BackgroundTintTypeAppEnum.none) {
Summary("Test Info") {
\.$timescale
\.$backgroundTint
}
} otherwise : {
Summary("Test Info") {
\.$backgroundTint
}
}
}
}
enum TimescaleTypeAppEnum: String, AppEnum {
case week
case fortnight
static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Trend Timescale")
static var caseDisplayRepresentations: [Self: DisplayRepresentation] = [
.week: "Past Week",
.fortnight: "Past Fortnight"
]
}
enum BackgroundTintTypeAppEnum: String, AppEnum {
case blue
case none
static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Background Tint")
static var caseDisplayRepresentations: [Self: DisplayRepresentation] = [
.none: "None (Default)",
.blue: "Blue"
]
}
I know I could achieve what I'm after by having a separate Intent and separate IntentTimelineProvider for each widget. But this all seems unnessecary for just a simple optional parameter based on what widget its configuring.... unless I'm missing the point about Intents, Widgets or something!
I've done a fair bit of other searching but can't find an answer to this overall scenario.
Many thanks for any help.
I am trying to write a unit test for an AppIntent and override the AppDependencyManager so I can inject dependencies for the purposes of testing. When I run a test, the app crashes with:
AppIntents/AppDependencyManager.swift:120: Fatal error: AppDependency of type Int.Type was not initialized prior to access. Dependency values can only be accessed inside of the intent perform flow and within types conforming to _SupportsAppDependencies unless the value of the dependency is manually set prior to access.
App Intent:
import AppIntents
struct TestAppIntent: AppIntent {
@AppDependency var count: Int
static var title: LocalizedStringResource { "Test App Intent "}
func perform() async throws -> some IntentResult {
print("\(count)")
return .result()
}
}
extension TestAppIntent {
init(dependencyManager: AppDependencyManager) {
_count = AppDependency(manager: dependencyManager)
}
}
Unit Test
import Testing
import AppIntents
@testable import AppIntentTesting
struct TestAppIntentTests {
@Test("test")
func test() async throws {
let dependencyManager = AppDependencyManager()
dependencyManager.add(dependency: 5)
let appIntent = TestAppIntent(dependencyManager: dependencyManager)
_ = try await appIntent.perform()
}
}
Hi! I am using the Automations in shortcuts in macOS 26 dev beta 1 and I have all my shortcuts working except this one. Why?(photo included). All the others are very similar except they do other things not make pdf. They work. Why does this one not. I tried changing the extension to .doc, or .docx instead of doc and docx I tried using if name ends in .docx I tried file filtering nothing. Any ideas? Thanks!
In WatchOS 26 you can now configure Apple Watch Widgets that use AppIntents instead of having a preconfigured option via AppIntentRecommendation.
This is demonstrated in the Weather Details Widget. In that, the Intent has been set up such that the options have icons for each parameter.
How can I update my Intent code to offer this?
struct DataPointsWidgetIntent: AppIntent, WidgetConfigurationIntent {
static var title: LocalizedStringResource = "Data Points Widget Configuration"
static var description = IntentDescription("Configure the individual data point display for Widgets.")
static var isDiscoverable: Bool { return false}
init() {}
func perform() async throws -> some IntentResult {
print("DataPointsWidgetIntent perform")
return .result()
}
@Parameter(title: "Show Individual Data Points", default: true)
var showDataPoints: Bool?
@Parameter(title: "Trend Timescale", default: .week)
var timescale: TimescaleTypeAppEnum?
static var parameterSummary: some ParameterSummary {
Summary("Test Info") {
\.$showDataPoints
\.$timescale
}
}
}
enum TimescaleTypeAppEnum: String, AppEnum {
case week
case fortnight
static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Trend Timescale")
static var caseDisplayRepresentations: [Self: DisplayRepresentation] = [
.week: "Past Week",
.fortnight: "Past Fortnight"
]
}
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
WidgetKit
Intents
WeatherKit
App Intents
I have an app that lets you create cars. I have a CarEntity, an OpenCarIntent, and a CreateCarIntent. I want to support the Open When Run option when creating a car. I understand to do this, you just update the return type of your perform function to include & OpensIntent, then change your return value to include opensIntent: OpenCarIntent(target: carEntity). When I do this, I get a compile-time error:
Cannot convert value of type 'CarEntity' to expected argument type 'IntentParameter<CarEntity>'
What am I doing wrong here?
struct CreateCarIntent: ForegroundContinuableIntent {
static let title: LocalizedStringResource = "Create Car"
@Parameter(title: "Name")
var name: String
@MainActor
func perform() async throws -> some IntentResult & ReturnsValue<CarEntity> & OpensIntent {
let managedObjectContext = PersistenceController.shared.container.viewContext
let car = Car(context: managedObjectContext)
car.name = name
try await managedObjectContext.perform {
try managedObjectContext.save()
}
let carEntity = CarEntity(car: car)
return .result(
value: carEntity,
opensIntent: OpenCarIntent(target: carEntity) // FIXME: Won't compile
)
}
}
struct OpenCarIntent: OpenIntent {
static let title: LocalizedStringResource = "Open Car"
@Parameter(title: "Car")
var target: CarEntity
@MainActor
func perform() async throws -> some IntentResult {
await UIApplication.shared.open(URL(string: "carapp://cars/view?id=\(target.id)")!)
return .result()
}
}
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
iOS
Shortcuts
Intents
App Intents
Hey everyone,
I have an issue I'm running into – maybe someone has the expertise to help!
I've created an app that adds Intents to the Shortcuts app, to interact with S3-compatible object storage. Everything works fine, until you decide to upload/download a large file, that your internet connection cannot handle in the ~30-second intent timeout.
I've explored uploading files with a background task which seems to work somehow, but the bigger issue would be downloading larger files, as other parts of the subsequent shortcut may rely on it.
To the question: Is there some way of increasing the timeout for a shortcuts intent, or a way to "trick" shortcuts into letting my custom intents download/upload files without timing out?
Thanks so much!
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Shortcuts
Background Tasks
Intents
App Intents
(Public dupe of FB16477656)
The Shortcuts app allows you to parameterise the input for an action using variables or allowing "Ask every time". This option DOES NOT show when conforming my AppEntity.defaultQuery Struct to EntityStringQuery:
But it DOES shows when confirming to EntityQuery:
As discussed on this forum post (or FB13253161) my AppEntity.defaultQuery HAS TO confirm to EntityStringQuery to allow for searching by String from Siri Voice input.
To summarise:
With EntityQuery:
My Intent looks like it supports variables via the Shortcuts app. But will end up in an endless loop because there is no entities(matching string: String) function.
This will allow me to choose an item via the Shorcuts.app UI
With EntityStringQuery:
My Intent does not support variables via the Shortcuts app.
I am not allows to choose an item via the Shorcuts.app UI.
Even weirder, if i set up the shortcut with using a build with EntityQuery and then do another build with EntityStringQuery it works as expected.
Code:
/*
Works with Siri to find a match, doesn't show "Ask every time"
*/
public struct WidgetStationQuery: EntityStringQuery {
public init() { }
public func entities(matching string: String) async throws -> [Station] {
let stations = [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
return stations.filter { $0.id.lowercased() == string.lowercased() }
}
public func entities(for identifiers: [Station.ID]) async throws -> [Station] {
let stations = [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
return stations.filter { identifiers.contains($0.id.lowercased()) }
}
public func suggestedEntities() async throws -> [Station] {
return [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
}
public func defaultResult() async -> Station? {
try? await suggestedEntities().first
}
}
/*
DOES NOT work with Siri to find a match, but Shortcuts shows "Ask every time"
*/
public struct WidgetBrokenStationQuery: EntityQuery {
public init() { }
public func entities(matching string: String) async throws -> [Station] {
let stations = [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
return stations.filter { $0.id.lowercased() == string.lowercased() }
}
public func entities(for identifiers: [Station.ID]) async throws -> [Station] {
let stations = [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
return stations.filter { identifiers.contains($0.id.lowercased()) }
}
public func suggestedEntities() async throws -> [Station] {
return [Station(id: "car", name: "car"), Station(id: "bike", name: "bike")]
}
public func defaultResult() async -> Station? {
try? await suggestedEntities().first
}
}```
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
Shortcuts
Intents
App Intents
Hello,
We are reaching out to the official forum as an option to help us solve an issue we’re encountering with our app.
The problem lies in the implementation of the AppIntents framework in our codebase, which, at the moment, is impossible to complete due to compilation errors occurring in specific targets of our app. We are currently using Xcode 16.0.
First of all, we want to clarify that the integration of the AppIntents library poses no issues in our development targets (pre-production environments), since no additional code obfuscation steps are performed there.
However, in the release targets used for production builds (those intended to be released to users), we encounter the following compilation error:
These errors indicate that the “.swiftconstvalues” files are missing for all of the files in our application.
We also want to highlight that we are using a code obfuscation tool called Arxan, provided by Digital.ai. This tool is integrated via specific Build Settings configurations, various files added to the project, and an additional Build Phase script.
We have conducted the following tests:
Disabling Arxan in release targets: The app compiles successfully and those files are generated (suspicious, I know).
Adding a library with AppIntents references and an AppIntent in our app: Both scenarios produce the same compilation error.
Creating a demo project with AppIntents and Arxan (basic implementation): The project compiles correctly and those files are in place.
Contacting Digital.ai support: They suggested several changes to the Build Settings, but none of them resolved the issue.
Additionally, we’ve attempted to gather information from the compiler to understand how these “.swiftconstvalues” files are generated. Unfortunately, we haven’t found any official documentation, so we would like to ask a few questions:
Is it possible to interfere with the creation of these files in any way? For example, via scripts or other custom build steps?
Is there any way to force the generation of these files through a build parameter or flag?
Is it possible to bypass the “Extract App Intents Metadata” step during compilation? If so, what would be the implications of doing this when using a library that includes references to AppIntents?
I know that involving a code obfuscation tool raises suspicions about it being the problem, we just want to know a little more about this compilation step to have some more context before reaching them again.
Feel free to ask any questions or details, any reply is appreciated.
Thanks
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
Developer Tools
Compiler
Intents
App Intents
I am working on a widget that allows the user to specify a list of items.
Each item is an AppEntity and has an id, a type and a name. In the DisplayRepresentation I have and icon / image for each type. So when I tap on the specified items option a list of user specified items comes up with the option to search, select, deselect items. This works nicely. I sort them suggested entities by type then name so the list is predictable. How would like to be able to have a group / type header for each type of item. However, I don't know how to do that with the AppEntities. Help would be appreciated.
I noticed that HomeKit takes a different approach. They have a list of items at the bottom labeled "Choose Scene Or Accessory". You can move the items up / down in the list, you can delete, and add items. When you tap "Add an item" in the list it goes to a search screen where the items are grouped by the room and have the individual items beneath them. I don't like that you have to select one item at a time but I love having the headings for the rooms. The question here is how did they do that? Is there sample code somewhere that does something similar.
I am using live activity in my app. Functionality is start, update & end events are started from the server. There is one interaction button added using app intent in live activity widget. That button needs to update widget ui locally using activity kit.
Issue is when os receives first start event push then update ui works fine and reflecting on live activity widget but when update notification receives by os after 1 mins then action button stops updating the ui locally.
Can anyone please add some suggestions to fix this.
how to register more than 10 shortcuts
I have a question about the app lifecycle when my app is launched via a Shortcut. I'm adding a INIntent to a Mac app. So my app delegate implements:
- (nullable id)application:(NSApplication *)application handlerForIntent:(INIntent *)intent
Then my custom intent handler implements the two protocol methods -confirmIntentNameHere:completion: and -handleIntentNameHere:completion:
During my testing -applicationDidFinishLaunching: is called before the intent methods, so I can forward methods to my main window controller to perform the shortcut actions, since it's already ready.
....But if this is not always the case, I can still perform them but I'd have to move the code out of the window controller to perform the action "headless" if invoked before my app has built its UI. Just wondering if this is something I should be prepared for.
Thanks in advance.
Was going to add a shortcut to an app via INIntent. I followed the WWDC developer.apple.com/videos/play/wwdc2021/10232/?time=986
Steps:
Created a .intentdefinition file and created an intent.
Added the intent to .intentdefinition and compiled the app.
Import the header file for the custom intent in the AppDelegate MyIntentname.h
Have the AppDelegate conform to the protocol created in the generated code.
Implement: -application:handlerForIntent: and return self (the app delegate)
Run the app.
Open the Shortcuts app and search for the 'shortcut' (according to the WWDC video linked above it should show up in the actions list).
Doesn't show up in the list.
I tried moving the build application out from Debug to my Applications folder to see if that would help the Shortcuts app find it, but it didn't.
Am I missing a step/doing something wrong?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Shortcuts
SiriKit
Intents
App Intents