I rarely use the Shortcuts app, so it took me a while to notice that my app's app intents all show incorrectly on macOS 15. On macOS 14 and 13, they used to show correctly, but now it seems that all localized strings show the key rather than the localized value.
@available(iOS 16.0, macOS 13.0, *)
struct MyAppIntent: AppIntent {
static let title = LocalizedStringResource("key1", comment: "")
static let description = IntentDescription(LocalizedStringResource("key2", comment: ""))
...
}
In Localizable.xcstrings file I have defined all the strings, for instance I have associated key1 with the value Title, but while the Shortcuts app used to display Title, it now displays key1.
Is this a known issue or did something change in macOS 15 that would require me to update something?
App Intents
RSS for tagExtend your app’s custom functionality to support system-level services, like Siri and the Shortcuts app.
Posts under App Intents tag
200 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have a home widget with buttons (new in iOS 17).
In order to prevent taking action if the user taps on the widget buttons accidentally, I want to ask the user for confirmation.
It appeared that requestConfirmation be exactly what I needed, but no confirmation view shows up when I invoke this method in the perform function.
I have tried the following:
try await requestConfirmation(result: .result(dialog: "Are you sure you want to do this?") {
Image(.mdlsWhite)
})
and this alternative:
let confirmed: Bool = try await $name.requestConfirmation(for: self.name,
dialog: IntentDialog(stringLiteral: msg))
Neither option work.
I am starting to think that the requestConfirmation is not to be used with Home Widgets.
Is there a better way to handle confirmations for buttons included in a Home Widget?
I'm currently working on an AppIntent in my app to import Apple Pay transactions via Transaction triggers in Shortcuts. While I can access the transaction name with the following code:
@Parameter(title: "Transaction")
var transaction: String
I'm not sure how to retrieve the full details of the transaction, including:
Card or Pass
Merchant
Amount
Name
At the moment, transaction only provides the name as a string, but I need access to the complete transaction data. I know that by selecting specific fields like Amount, Merchant, etc., I can retrieve each piece of data individually, but it would be much easier and more user-friendly to simply retrieve the entire transaction object at once.
Has anyone successfully retrieved all details of an Apple Pay transaction in this context, and if so, could you share how to do so?
Topic:
App & System Services
SubTopic:
Apple Pay
Tags:
Shortcuts
Apple Pay
App Intents
Tap to Pay on iPhone
I've been stuck for days trying to figure out how to extract the full text of a Siri prompt that launches my app. We need to be able to get the text of the full command, such as "Hey siri, buy dogfood...." so I can get "dogfood" or anything else following 'buy' . The examples I am finding are a) out of date or b) incomplelete. Right now we're using AppIntents with Shortcuts, but have to use dedicated shortcuts for each specific purchase, which are obviously very limiting.
Hi, I am trying to understand how this mechanism integrates with shortcuts (and i guess siri + apple intelligence in near future) and other apps.
Basic setup is an AppEntity that implements 'transferable' and is returning a DataRepresentation of 'text'.
got an AppIntent returns a one of the 'entitities' and I'm simply trying to pass the result to initially email or another app using shortcuts. even with canned 'hello world' string being marshalled into DataRepresentation(.text) I am not seeing anything in usual system targets like email, messages, notes. It opens the app ok, but no text is present. (note: if I use an incorrect DataRepresentation type with email it'll flat out fail saying 'not correct 'text' type)
What exactly do I need to do here and is there any example code I can look at?
thanks
In iOS 18, the requestValue method no longer works when the parameter it is called on is not included in the parameterSummary of an AppIntent. This issue causes the app to fail to present a prompt for the user to select a value, resulting in an error with the message:
Domain=NSCocoaErrorDomain Code=4099 "The connection from pid 40685 on anonymousListener or serviceListener was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid."
Steps to Reproduce:
Create a simple AppIntent with the following code:
import AppIntents
struct Intent: AppIntent {
static let title: LocalizedStringResource = "Intent"
static var parameterSummary: some ParameterSummary {
Summary("Test \(\.$category)") {}
}
@Parameter(title: "Category")
private var category: CategoryEntity?
@Parameter(title: "Hidden Category")
private var hidden: CategoryEntity?
@MainActor
func perform() async throws -> some ReturnsValue<CategoryEntity?> {
var result: CategoryEntity?
do {
result = try await $hidden.requestValue("Select category") // Doesn't work since iOS 18 as $hidden is not set in parameterSummary
} catch {
print("\(error)")
}
return .result(value: result)
}
}
Run the code on a device with iOS 18.
Observe that the requestValue method fails to present the selection prompt and instead throws an error.
Expected Results:
The app should successfully present a prompt for the user to select a value for the hidden parameter using requestValue, even if the parameter is not included in the parameterSummary.
Actual Results:
The app fails to present the selection prompt and throws an error, making it impossible to use requestValue for parameters not included in parameterSummary.
Version/Build:
iOS 18.0
Configuration:
Tested on various devices running iOS 18.
Is there a change in the API that I might have missed?
Xcode 16.2 are unavailable to develop widget with dynamic options, no matter SiriIntent or AppIntent that I try to use.
I have try to start a complete new project, then add widget with app intent checkbox check, with zero code changed then i press command run and WidgetKit Simulator present CHSErrorDomain error 1103 always, if i try to add widget directly from desktop, dynamic options are available to select but widgets doesn't seem like load successfully, it is stuck same in the WidgetKit Simulator.
I also try to start a new project in my other MacBook but no luck, this error are presenting all the time, I'm totally stuck here, does anybody having this issue?
Hi everyone.
I'm trying to use the new ControlWidget API introduced on iOS 18 to open a sheet that contains a form when the user taps on the button on the control center.
This is my current code. It opens the app, but I haven't found how to do an action inside the app when the app is opened.
@available(iOS 18, *)
struct AddButtonWidgetControl: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: "com.example.myapp.ButtonWidget") {
ControlWidgetButton(action: LaunchAppIntent()) {
Label("Add a link", systemImage: "plus")
}
}
.displayName("Add a link")
.description("Creates a link.")
}
}
@available(iOS 18, *)
struct LaunchAppIntent: AppIntent {
static var title: LocalizedStringResource { "Launch app" }
static var openAppWhenRun: Bool = true
func perform() async throws -> some IntentResult {
return .result()
}
}
在执行完 INIntent 或者AppIntent的Shortcuts后,刷新 WidgetKit桌面小组件
not sure where to post this hence adding here.
how to run in this full screen mode even when the screen is locked. As far as I looked, it’s only live activities that the developers are made available with. Is there a way to create our own UI on lockscreen, given a similar usecase exists?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Inter-process communication
WidgetKit
App Intents
ActivityKit
I have an image based app with albums, except in my app, albums are known as galleries.
When I tried to conform my existing OpenGalleryIntent with @AssistantIntent(schema: .photos.openAlbum), I had to change my existing gallery parameter to be called target in order to fit the predefined shape of this domain.
Previously, my intent was configured to display as “Open Gallery” with the description “Opens the selected Gallery” in the Shortcuts app. After conforming to the photos domain, it displays as “Open Album” with a description “Opens the Provided Album”.
Shortcuts is ignoring my configured title and description now. My code builds, but with the following build warnings:
Parameter argument title of a required Assistant schema intent parameter target should not be overridden
Implementation of the property title of an AppIntent conforming to AssistantSchemaIntent should not be overridden
Implementation of the property description of an AppIntent conforming to AssistantSchemaIntent should not be overridden
Is my only option to change the concept of a Gallery inside of my app into an Album? I don't want to do this... Conceptually, my app aligns well with this domain does, but I didn't consider that conforming to the shape of an AI schema intent would also dictate exactly how it's presented to the user.
FB16283840
Topic:
Machine Learning & AI
SubTopic:
Apple Intelligence
Tags:
Siri and Voice
Shortcuts
App Intents
Apple Intelligence
The Shortcuts app offers the possibility to trigger shortcuts/intends when a wallet credit card is used and a new transaction is created.
I would like to add transaction details to one of my apps and use such a shortcut for it. Other apps do the exact same thing, so this should not be a problem.
Adding a shortcut to my app was not a big deal. However, how can this be tested on simulator?
When trying to add a new automatization in the Shortcuts app using a wallet transaction as trigger I cannot finish the setup dialog since the Next button is disabled. I assume this is because no card is configured.
When trying to add a card in Wallet I just receive that this was not successful.
I have connected the simulator to a Sandbox Apple ID account using a region which supports Apple Pay (US). Using a real account does not solve the problem.
Any idea how to get this working?
Using real transaction within a store could obviously not be the solution for debugging.
I’ve implemented an Intent Extension and added support for handling the INSendMessageIntent in the intent handler class.
Currently, this intent is automatically visible in the Shortcuts app by default. However, for security reasons (as it involves handling phone numbers), I want to restrict the use of this intent to Siri only and ensure it does not appear in the Shortcuts app.
Has anyone encountered this requirement before or knows a way to prevent the intent from appearing in the Shortcuts app, while still keeping it functional via Siri?
Looking forward to your suggestions!
After building my app with Xcode 16 beta 6 I'm getting this warning in my AppIntents.
Encountered a non-optional type for parameter: computer. Conformance to the following AppIntent protocols requires all parameter types to be optional: AppIntents.WidgetConfigurationIntent, AppIntents.ControlConfigurationIntent
The intent looks something like this
struct WakeUp: AppIntent, WidgetConfigurationIntent, PredictableIntent {
@Parameter(title: "intent.param.computer", requestValueDialog:"intent.param.request_dialog.computer")
var computer: ComputerEntity
init(computer: ComputerEntity) {
self.computer = computer
}
init() {
}
public static var parameterSummary: some ParameterSummary {
Summary("Wake Up \(\.$computer)")
}
static var predictionConfiguration: some IntentPredictionConfiguration {
IntentPrediction(parameters: (\.$computer)) { computer in
DisplayRepresentation(
title: "Wake Up \(computer)"
)
}
}
@MainActor
func perform() async throws -> some IntentResult & ProvidesDialog {
}
}
According to the docs though specifying optional is how we say if the value is required or not. https://developer.apple.com/documentation/appintents/adding-parameters-to-an-app-intent#Make-a-parameter-optional-or-required
So is this warning accurate? If so, how do I specify that a parameter is required by the intent now?
Hi Devs,
I’ve created an app intent shortcut for our Best Buy app. This shortcut is visible on iOS 17.2 and later. However, I’ve marked it to support iOS 16+ as shown below:
import AppIntents
@available(iOS 16.0, *)
struct LaunchIntent: OpenIntent {
why we are not able to see shortcuts for iOS 16?
I've been exploring the Trails Sample App from this session at WWDC24.
The app has a TrailEntity of type AppEntity which is leveraged in multiple places throughout the app, including:
The GetTrailInfo App Intent with a trail parameter of type TrailEntity.
A parameterized App Shortcut which calls the GetTrailInfo intent.
The TrailDataManager's init calls updateSpotlightIndex(), which creates a CSSearchableItem for each Trail in the app, along with an associateAppEntity call linking the corresponding TrailEntity to each item that gets added to the CSSearchableIndex.
If you build the app and search "trails" in Spotlight, the Trails Sample App section includes instances of TrailEntity as search results. But if you comment out the App Shortcut that takes a TrailEntity as a parameter and rebuild, there are no instances of TrailEntity in the search results. In both cases, the console prints [Spotlight] Trails indexed by Spotlight.
Is this expected behavior? Why are the TrailEntity instances only appearing in Spotlight via the App Shortcut? Shouldn't the CSSearchableItem instances show up in Spotlight on their own regardless? If not, then what is the purpose of adopting Core Spotlight with App Entities? Does this add the app entities to the semantic index for "new Siri", even though they're not user facing in the Spotlight UI?
Topic:
App & System Services
SubTopic:
General
Tags:
Shortcuts
Core Spotlight
App Intents
Apple Intelligence
I'm using the AppIntents framework introduced in iOS 16. My goal is to create an AppIntent that performs a long-running task but does open my app when run. When I run the Intent from the Shortcuts app, I see an error message that says the shortcut "was interrupted because it didn't finish executing in time." Is there a way to signal progress to the user of a long-running AppIntent or get more time from the system prior to the AppIntent being cancelled?
Hi everyone,
I have a simple question regarding App Intents. I have an intent that defines a few parameters, one of which is a Date. When the user is prompted for input, I’d like the date picker to start at a specific value (e.g., tomorrow) instead of the default current date.
Is there a way to set an initial/default value for the date parameter in an App Intent?
Thanks in advance for any guidance!
Hi all, I'm working on a really basic counter app as a way to explore SwiftData and have come across some behavior that I don't understand. I have a very simple App Intent that increments a user-specified counter in my app. The intent doesn't throw any errors and correctly updates the CoreData store but, when I switch back to my app from the Shortcuts app (where I'm testing the app intent), the view hasn't updated. Closing and re-opening the app shows the incremented counter value but I'd like to know if it's possible to have my app's UI update when the CoreData store is updated from outside the app without relaunching the whole app.
For some brief context, here's my view and the App Intent:
struct ContentView: View {
@Environment(\.modelContext) private var modelContext
@Query private var counters: [Counter]
// ...
var body: some View {
NavigationStack {
List {
ForEach(counters) { counter in
CounterRowItem(counter: counter)
}
.onDelete(perform: deleteItems)
}
// ...
}
}
struct IncrementCounterIntent: AppIntent {
static var title: LocalizedStringResource = "Increment Counter"
@Parameter(title: "Name", optionsProvider: CounterOptionsProvider()) var name: String
func perform() async throws -> some IntentResult & ReturnsValue<Int> {
let provider = try CounterProvider()
guard let counter = try provider.fetchCounters().first(where: { $0.name == name }) else {
print("Couldn't find counter with name '\(name)'")
return .result(value: 0)
}
counter.count += 1
try provider.context.save()
return .result(value: counter.count)
}
private final class CounterOptionsProvider: DynamicOptionsProvider {
func results() async throws -> [String] {
try CounterProvider().fetchCounters().map { $0.name }
}
}
}
I have an App Intent that returns a MyEntity value with the following properties:
struct MyEntity: AppEntity {
@Property(title: "Title")
var title: String?
@Property(title: "Image")
var image: IntentFile?
}
I created a Shortcut that takes the output value of this intent and passes it as the input to the Send Message action. When I tap the MyEntity parameter in the message action, it shows to be of Type MyEntity. Below that, I can select 1 of 3 options: MyEntity, Title, or Image.
When I run the shortcut, a new message compose window appears with the following behavior depending on the selected option:
MyEntity - the message draft is empty
Title - the message draft shows the title string
Image - the message draft shows the image
My expected and desired result when MyEntity is selected would be a message draft populated with the image and the title string as text. How would I achieve this? Is it possible?
I've experimented with conforming MyEntity to Transferable. That's enabled use cases such as passing the MyEntity input as Type Image for example.
Do I need to create a custom UTType to represent MyEntity, or is that unrelated to my issue? I haven't explored this yet but seems potentially related!
Topic:
App & System Services
SubTopic:
General
Tags:
Shortcuts
Uniform Type Identifiers
App Intents
Core Transferable