Exploring AppIntents and Shortcuts. No matter what I try Siri won't understand parameters in an initial spoken phrase.
For example, if I ask: "Start my planning for School in TestApp", Siri responds: "What's plan?", I say: "School" and Siri responds "Ok, starting Shool plan"
What am I missing so it won't pick up parameters right away?
Logs inside func entities(matching string: String) are only called after "What's plan?" question and me answering "School". No logs after the initial phrase
Tried to use Apple's Trails example as a reference but with no luck
Shortcuts
RSS for tagHelp users quickly accomplish tasks related to your app with their voice or with a tap with the Shortcuts API.
Posts under Shortcuts tag
108 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I’m trying to run a Shortcut from my iPhone’s Action button and immediately dictate input by voice, without tapping or switching modes.
Currently, it always defaults to a text field. Voice dictation works seamlessly if I trigger the shortcut via a voice command, but not when I use the Action button.
Is there a way, API, or future plan from Apple to allow voice dictation after the Action button triggers a Shortcut? Any guidance or ideas would be really helpful!
I have a very basic App Intent extension in my macOS app that does nothing than accepting two parameters, but running it in Shortcuts always produces the error "The action “Compare” could not run because an internal error occurred.".
What am I doing wrong?
struct CompareIntent: AppIntent {
static let title = LocalizedStringResource("intent.compare.title")
static let description = IntentDescription("intent.compare.description")
static let openAppWhenRun = true
@Parameter(title: "intent.compare.parameter.original")
var original: String
@Parameter(title: "intent.compare.parameter.modified")
var modified: String
func perform() async throws -> some IntentResult {
return .result()
}
}
The Verify the behavior of your intent in Simulator or on-device documentation says that it's sufficient to build and run the app and open the Shortcuts app to test an app intent, but that doesn't seem to be the case. I always needed to at least move the debugged app to the Applications folder before the app intents showed up in Shortcuts, and even then, most of the times I also need to wait a lot or restart the Mac. When updating an existing app intent (for instance by changing its title), building the app, overwriting the existing one in the Applications folder and restarting Shortcuts is not sufficient to make the new title appear in Shortcuts.
Is there an efficient way to test app intents in the Shortcuts app? I already created FB15638502 one month ago but got no response.
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?
Hi!
So while Date is supported for @Parameter in an App Intent, I just discovered that Xcode will not let me use use it in a parametrized App Shortcut phrase.
In my case, I would like to give the option to say "today", tomorrow", or "day after tomorrow" for the date. Am I missing something? Any hints on the best way to approach this?
Hi!
In neither Xcode 16.2 beta 3 nor Xcode 16.2 I am able to get App Shortcuts Preview to recognise my Shortcuts. In either supported language I always get "No Matching Intent" as the result.
Flexible matching is enabled, minimum deployment target is iOS 18. The Shortcut phrases do work in the simulator and on device.
Is this a known issue or am I missing something?
There is a bug when try to open the push notification of appintent at the lock screen.
How to determine whether the shortcut command is triggered by Siri or the user clicks?
Hi!
SiriTipView(intent:) shows the first phrase for my App Shortcut, but unlike ShortcutsLink(), does not use the localized applicationName. Hence the phrase shown does not work 😬
Is this a known limitation, any workarounds?
Hi!
When my device is set to English, both search and the Shortcuts up automatically show multiple shortcuts parametrised for each value of the AppEnum - which is what I expected. When my device is set to German, I get only the basic AppShortcut without the (optional) parameter.
I am using an AppEnum (see below) for the parametrised phrases and localise the phrases into German with an AppShortcuts String Catalog added to my project.
Everything else seems to work, I can use my AppShortcut in the Shortcuts app and invoke it via Siri in both English and German.
The Shortcuts app displays the values correctly using the localized strings.
Any ideas?
import AppIntents
class ApolloShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: GetIntent(),
phrases: [
"Get data from \(.applicationName)",
"Get data from \(.applicationName) for \(\.$day)",
"Get data from \(.applicationName) for the \(\.$day)"
],
shortTitle: "Get Data",
systemImageName: "wand.and.sparkles")
}
}
enum ForecastDays: String, AppEnum {
static var typeDisplayRepresentation: TypeDisplayRepresentation = "Day"
static var caseDisplayRepresentations: [Self : DisplayRepresentation] = [
.today: DisplayRepresentation(title: LocalizedStringResource("today", table: "Days")),
.tomorrow: DisplayRepresentation(title: LocalizedStringResource("tomorrow", table: "Days")),
.dayAfterTomorrow: DisplayRepresentation(title: LocalizedStringResource("dayAfterTomorrow", table: "Days"))
]
case today
case tomorrow
case dayAfterTomorrow
var displayName: String {
String(localized: .init(rawValue), table: "Days")
}
}
In IOS 18.2 Beta 3 and earlier versions unfortunately it is not possible, to make shortcut use a variable to add a tag to a note.
Whenever this is running it opens up the list of tags and asks for manual input instead of using the variable that is placed in the textfield of the apply tag command.
Would be great if someone responsible could adjust that so it works.
Thxs :-)
This message only to know your feeling on my project. Not to discuss what is feasible or not. Just on the interest of the functionality.
I use 5 Focus profiles, Do Not Disturb, Holiday, Work, Personal and Sleep. I find that the native solutions for changing modes are not powerful enough.
I'd like an app to configure automatically when each Focus profile should be activated.
Eg :
-Holiday : when holiday is found in my calendar
-Work : when I'm not on holiday, when we are not on the weekend, and after 7ham but before 7pm.
Personal : when I'm not on holiday when we are on the weekend of after 7pm
-Dot Not Disturb: When I'm not in holiday, only on the working week when I have an event in my agenda with the status accepted".
These are just some examples. the idea is that everything will be configurable. (my app is almost finished.)
What do you think?
Imagine we have an Xcode workspace containing two projects:
MyLibrary.xcodeproj holding a framework target
MyShortcutsApp.xcodeproj holding an app target which consumes MyLibrary framework
Both targets define App Intents and the ones from MyLibrary are exposed via AppIntentsPackage accordingly.
When trying to wrap the App Intent from framework as App Shortcut and passing localized AppShortcutPhrases I do see the following compile error:
".../Resources/de.lproj/AppShortcuts.strings:11:1: error: This AppShortcut does not map to a known action (MyLibraryIntent specified). (in target 'MyShortcutsApp' from project 'MyShortcutsApp')"
If I use the same localized App Shortcut phrases for an App Intent which is locally defined in the app target, everything works fine and also if I use the framework-provided App Intent in and App Shortcut without passing any localized phrases.
This is happening with Xcode 16.0 (16A242d), with 16.1 (16B40) and with 16.2 beta 2 (16C5013f).
I already raised this issue via FB15701779 which contains a sample project to reproduce and to further analyze the issue.
Thanks for any hint on how to solve that.
Frank
I'm curious if anyone else has figured out why an intent defined in the intents file never seems to appear in the Shortcuts app on MacOS.
I'm following the steps outlined in "Meet Shortcuts for MacOS" from WWDC 2021.
https://developer.apple.com/videos/play/wwdc2021/10232
I build and run my app, launch Shortcuts, and the intent I defined refuses to show up!
There's one caveat - I allowed Xcode to update to 16.1, and mysteriously the intent became available in Shortcuts.app. When I went to add a second intent, I see the same as above - it simply never shows up in Shortcuts.app.
I have a few intents I'd like to write/add, but this build/test cycle is really slowing me down.
This app is a completely fresh Swift-AppKit app, I've never archived it, so there shouldn't be more than one copy on disk. I have also cleaned the build folder, restarted Xcode, restarted Shortcuts, restarted my machine entirely...
Anyone see this before and find a workaround? Any advice on how to give Shortcuts.app a kick in the rear to try and find my second intent?
I have implemented ShowInAppSearchResultsIntent and AppShortcutsProvider. But on iOS 18.1+ getting and error in console :- Failed to generate TargetContentIdentifier for criteria.
In iOS 18.0 it's working fine.
The code I have implemented
@AssistantIntent(schema: .system.search)
struct SearchIntent: ShowInAppSearchResultsIntent {
// static let title: LocalizedStringResource = "Search in Cineverse for"
static let searchScopes: [StringSearchScope] = [.general]
@Parameter(requestValueDialog: IntentDialog("What would you like to search for?"))
var criteria: StringSearchCriteria
@MainActor
func perform() async throws -> some IntentResult {
let searchString = criteria.term
print("Searching for \(searchString)")
return .result()
}
}
class AppShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: SearchIntent(),
phrases: [
"using \(.applicationName) search for",
"search on \(.applicationName) app"
],
shortTitle: "Search Movie",
systemImageName: "magnifyingglass"
)
}
}
I'm doing statistical formulas and need the keyboard shortcut of the symbol used to represent standard deviation (sigma), which should look like (σ).
Everything online suggests using the keyboard shortcut for option + w, but when I use that shortcut I get, ∑ instead. I've tried searching OS settings and there doesn't seem to be a place to change or determine what is the proper keyboard shortcut.
The keyboard shortcut for statistical mean (mu) is working, µ
And greater than or equal to, ≥
And less than or equal to, ≤
are also working.
Hello everyone,
I'm currently working on an App Intent for my iOS app, and I’ve encountered a frustrating issue related to how Siri prompts for a category selection. Here’s an overview of what I’m dealing with:
extension Category: AppEntity, @unchecked Sendable {
var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(title: "\(name)")
}
static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Category")
typealias DefaultQueryType = ShortcutsCategoryQuery
static var defaultQuery: ShortcutsCategoryQuery = ShortcutsCategoryQuery()
}
struct ShortcutsCategoryQuery: EntityQuery {
func entities(for identifiers: [String]) async throws -> [Category] {
let context = await ModelContext(sharedModelContainer)
let categories = try CategoryDataProvider(context: context).getItems()
return categories.filter { identifiers.contains($0.id) }
}
func entities(matching string: String) async throws -> [Category] {
return try await suggestedEntities()
}
func suggestedEntities() async throws -> [Category] {
let context = await ModelContext(sharedModelContainer)
do {
let categories = try CategoryDataProvider(context: context).getItems()
if categories.isEmpty {
print("No categories found.")
}
return categories.map { category in
Category(
id: category.id,
name: category.name,
stringSymbol: category.stringSymbol,
symbol: category.symbol,
stringColor: category.stringColor,
color: category.color
)
}
} catch {
print(error)
return []
}
}
}
The issue arises when I use Siri to invoke the intent. Siri correctly asks me to select a category but does not display any options unless I said something that Siri recognized, like "Casa(House) or *****(Test)" in portuguese. Only then does it show the list of available categories.
I would like the categories to appear immediately when Siri asks for a selection. I've already tried refining the ShortcutsCategoryQuery and debugging various parts of my code, but nothing seems to fix this behavior.
I keep seeing that there's a shortcut called "Add transaction" where whenever a card was tapped from apple wallet, you can add some automation.
https://support.apple.com/en-au/guide/shortcuts/apd65c67538a/7.0/ios/17.0
However, I cannot for the life of me find this option on my iphone 13 ios 17.6.1
All I can find when I go to the shortcuts app and search for transactions or apple wallet, I get 2 options to send/receive payments which isn't what I'm looking for.
Did apple remove this shortcut??
Hello.
I have NFC tags that I scan before walking my dog, that set off a list of shortcuts.
The shortcuts have been failing the last couple of weeks but were fine before that. seems to be a problem with linking to starting a walk in apple watch workouts?!
I have the latest iOS 18 public beta running (18.1) and watchOS 11.0.1