Shortcuts

RSS for tag

Help users quickly accomplish tasks related to your app with their voice or with a tap with the Shortcuts API.

Posts under Shortcuts tag

102 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Does INIntent no longer work on macOS? Can't get shortcut to show up in Shortcuts app
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?
2
0
78
May ’25
View shown by App Intent with ShowsSnippetView doesn't adapt to dark mode
I have an App Intent that conforms to ShowsSnippetView and returns a view that is shown in the Siri interface after the shortcut runs. The view simply consists of a VStack with a Text element, with no special styling. When my device is set to dark mode, the view doesn't adapt: the text is black, but the background of the Siri interface is a transparent dark gray, which makes the text almost unreadable. The text should be white in dark mode. The colorScheme environment value inside the view corresponds to light mode, even though the device is set to dark mode. This is most likely a bug in iOS.
14
0
138
Jun ’25
AppIntent AppShortcuts How to get a Double returned for a parameter and how to use the resolvers?
Hello, I have two related questions: in this AppIntent: https://github.com/poml88/FLwatch/blob/moresimple/SharedPhoneWatch/AppIntents/AddInsulin.swift#L2 i am trying to work with are returned Double as the parameter. But it does not fully work, because there is a locale issue. in some languages the decimal point is a comme. If that is so, Siri returns 3,5 but the system does not use it as a double. How to solve that? or, she is returning five, not 5 and again. The system does not recognise the double. It seems Apple has some resolvers for this, for example: DoubleFromStringResolver. https://developer.apple.com/documentation/appintents/resolvers But I cannot figure out how to use them are how to call that resolver. Can somebody help, please? Thanks.
2
0
114
Jul ’25
Shortcuts Services doesn't work properly in Books & iMessages
The built-in Books and iMessages on the latest macOS can not handle Shortcuts properly. If Books (no matter the Home scheme or the reading scheme) or iMessages is the current focused application, Shortcuts doesn't work. Once I move out and focus app turns to Finder or any other app, Shortcuts works properly. An exception is that when I pin the shortcut in the Menu Bar, the Menu Bar one works, while the one in the application's menu doesn't work. I have no idea why this would happen. Could it be part of privilege control or something?
0
1
45
May ’25
Intents UI Extension automatically dismisses
I am working on implementing a new Intents UI Extension and have noticed that when it is triggered via the "Hey Siri" voice command, the intent dismisses after a few seconds. However, if it is launched from the Shortcuts app, the intent remains active and does not dismiss automatically. Additionally, I’ve observed that this behavior occurs on specific iOS versions, such as 17.5.1 or 17.7. On other versions, like 17.4.1 or 18.4, the intent persists as expected. Does Siri automatically close the intent based on its own logic? Could the iOS version be influencing this behavior? Given the requirement to make the intent persistent, is there any option or configuration available to achieve this?
0
0
47
Apr ’25
Disambiguation for .system.search AppIntent
I'd like to display a list of items to disambiguate for a fulltext search intent. Using the Apple AppIntentsSampleApp, I added TrailSearch.swift: import AppIntents @AssistantIntent(schema: .system.search) struct TrailSearch: AppIntent { static let title: LocalizedStringResource = "Search Trail" static let description = IntentDescription("Search trail by name.", categoryName: "Discover", resultValueName: "Trail") @Parameter(title: "Trail") var criteria: StringSearchCriteria func perform() async throws -> some IntentResult & ReturnsValue<TrailEntity> { if criteria.term.isEmpty { throw $criteria.needsValueError(IntentDialog("need value")) } let trails = TrailDataManager.shared.trails { trail in trail.name.contains(criteria.term) } if trails.count > 1 { throw $criteria.needsDisambiguationError(among: trails.map { StringSearchCriteria(term: $0.name) }) } else if let firstTrail = trails.first { return .result(value: TrailEntity(trail: firstTrail)) } throw $criteria.needsValueError(IntentDialog("Nothing found")) } } Now when I type "trail" which matches several trails and thus lets us enter the disambiguation code path, the Shortcut app just displays the dialog title but no disambiguation items to pick from. Is this by design or a bug? (filed as FB17412220)
0
0
45
Apr ’25
Parameter recognition on AppShortcuts invocation not consistent
While playing around with AppShortcuts I've been encountering some problems around getting the invocation phrase detected and/or the parameter get recognized after invocation phrase via Siri. I've found some solutions or explanations here in other posts (Siri not recognizing the parameter in the phrase & Inform iOS about AppShortcutsProvider), but I still have one issue and it's about consistency. For context, I've defined the parameter to be an AppEntity with it's respective query conforming to the EntityStringQuery Protocol in order to be able to fetch entities with the string given by Siri struct AnIntent: AppIntent { // other parts hidden for clarity @Parameter var entity: ModelEntity } For an invocation phrase akin to "Do something with in ", if the user uses the phrase with a entity previously donated via suggestedEntities() the AppShortcut get executed without problems. If the user uses a phrase with no parameter, like "do something with ", if the user gets asked to input the missing parameter and inputs one, it may or may not get recognized and be asked to input a parameter again, like in a loop. This happens even if the parameter given is one that was donated. I've found that when this happens the entities(matching string: String) function in the EntityQuery doesn't get called. The input can be of one word or sometimes two and it will not be called. So in other words entities(matching string: String) does not get called on every user parameter input Is this behavior correct? Do parameters have some restrictions on length or anything? Does Siri shows the user suggested entities when asked for entity input? It doesn't on my end. Additional question related to AppShortcuts: On AppShortcut definition, where the summary inside the parameter presentation is used? I see that it was defined in the AppIntentsSampleApp for the GetTrailInfo Intent but didn't find where it was used
0
0
52
Apr ’25
/usr/bin/shortcuts no longer works in 14.7.5 (23H527) ?
I've been using /usr/bin/shortcuts for various tasks (eg. Quicksilver uses it to list and run shortcuts), and after updating from 14.7.4 to 14.7.5 the tool gets killed on startup. Eg. here is what it looks like in my shell: ❯ shortcuts list zsh: killed shortcuts list (And this is regardless of whether I have "full disk access" or "developer tools" toggled on or off for iTerm.) Looking at system logs it seems like the binary is missing an entitlement, which causes MACF / Gatekeeper to throw a fit: 2025-04-12 18:38:48.847576 kernel: mac_vnode_check_signature: /usr/bin/shortcuts: code signature validation failed fatally: When validating /usr/bin/shortcuts: in-kernel: com.apple.shortcuts.ShortcutsCommandLine disallowed without com.apple.private.security.restricted-application-groups 2025-04-12 18:38:48.847582 kernel: validation of code signature failed through MACF policy: 1 2025-04-12 18:38:48.847583 kernel: check_signature[pid: 2475]: error = 1 2025-04-12 18:38:48.847587 kernel: proc 95761: load code signature error 4 for file "shortcuts" 2025-04-12 18:38:48.847613 kernel: exec_mach_imgact: not running binary "shortcuts" built against preview arm64e ABI 2025-04-12 18:38:48.855481 syspolicyd: (Security) SecTrustEvaluateIfNecessary 2025-04-12 18:38:48.857970 syspolicyd: [com.apple.syspolicy.exec:default] GK evaluateScanResult: 2, PST: (path: /usr/bin/shortcuts), (team: (null)), (id: (null)), (bundle_id: (null)), 0, 0, 1, 0, 1, 1, 0evaluateScanResult: 2, PST: (path: /usr/bin/shortcuts), (team: (null)), (id: (null)), (bundle_id: (null)), 0, 0, 1, 0, 1, 1, 0 I used Time Machine to compare the binary's entitlements between 14.7.4 and 14.7.5, and looks like in 14.7.5 /usr/bin/shortcuts indeed is missing the com.apple.private.security.restricted-application-groups entitlement that 14.7.4 had. The old binary had these two entitlements that the new one doesn't: [Key] com.apple.private.security.restricted-application-groups [Value] [Array] [String] group.com.apple.shortcuts [String] group.is.workflow.my.app [String] group.is.workflow.shortcuts [Key] com.apple.security.application-groups [Value] [Array] [String] group.com.apple.shortcuts [String] group.is.workflow.my.app [String] group.is.workflow.shortcuts Is there a sensible workaround for this (and by "sensible" I mean something that'd allow me to keep using the tool)? (I already asked this on the support forums but I figured I might as well ask here too)
3
0
110
Apr ’25
Error with App Shortcut phrase: A single phrase can only use a single parameter
After installing the latest version of Xcode (16.3, 16E140), I get many instances of this error when building my app: Error: Multiple parameters detected in phrase. A single phrase can only use a single parameter. Here is an example of an App Shortcut that is causing this error: AppShortcut( intent: SelectModelIntent(), phrases: [ "Select \(\.$model) in \(.applicationName)", ], shortTitle: LocalizedStringResource("Select Model", comment: "Title for Shortcut"), systemImageName: "rectangle.3.group" ) If I replace the application name parameter with a hard-coded string, I get an error that says I need to have the application name parameter in each phrase. So is it not possible to have any other parameters in a phrase besides the application name? That seems unlikely to me.
4
0
91
Apr ’25
Dynamic parameters in shortcuts
I need to have a dynamic parameter for Shortcuts, so a person can say something like Hey Siri, order a pizza with The parameter code in the appIntent is @Parameter(title: "Title") var itemName: String In the Shortcut I use: AppShortcut( intent: NewItemIntent(), phrases: [ "order \(\.$itemName) using \(.applicationName)" ], shortTitle: "Order Item", systemImageName: "sparkles" ) When I call it "hey Siri, order pizza using ***" where pizza should be passed via the parameter then handed off to the appintent. However, it ignores the spoken parameter in lieu of putting up a dialog asking "What's the name?" I can say "pizza" and it now works. How can I pick up the parameter without having to go to that second step as the code implies?
5
0
166
Apr ’25
Difficulties with Get Contents of URL
I’ve created several shortcuts that tell me the stock price of a given company. The shortcut queries Yahoo Finance using Get Contents of URL, with the URL https://finance.yahoo.com/quote/TICKER SYMBOL/, for example https://finance.yahoo.com/quote/PLTR/ for Palantir or https://finance.yahoo.com/quote/AAPL/ for Apple, etc. Then it uses RegEx to parse out the numbers which it then formats and displays in a notification. Simple. It works great for several stocks, but for some reason, it does not work correctly for Palantir. It shows an older “previous close” price. Oddly, when I go to the website myself, it shows me the current stock price. So for today Mar 21 https://finance.yahoo.com/quote/PLTR/ shows me $90.96 (correct) but the shortcut, via Get Contents of URL, shows $87.39 (incorrect). This $87.39 price is listed further down in the page as a "previous close” price. I don’t get it. Here is a link to my Palantir shortcut: https://www.icloud.com/shortcuts/edea6ee0261245f49b078efc74d632dd Here is a link to my Apple shortcut: https://www.icloud.com/shortcuts/54a416393203432aa356fe76373e3f8b So the question is, why does Get Contents of URL show an old stock price but when I go to the site myself, it shows the correct stock price … and only for Palantir? I have about six shortcuts running correctly. Palantir is the only one that does not work. Been banging my head on this one for weeks. Any advice would be much appreciated. Thank you, Rob
0
0
34
Mar ’25
Siri Shortcut Phrases iOS -17
I made a set of Siri Shortcuts in my app with the AppShortcutsProvider, and they each have a set of phrases. I can activate the shortcuts via Siri phrases or Spotlight search on iOS 18+, but not on iOS -17. I've checked the documentation and see that AppShortcutsProvider is supported from iOS 16+, so I don't understand why I can't view the shortcuts in Spotlight or activate them with Siri unless it's at least iOS 18. Any thoughts?
4
0
290
Mar ’25
Group AppIntents’ Searchable DynamicOptionsProvider in Sections
I’m trying to group my EntityPropertyQuery selection into sections as well as making it searchable. I know that the EntityStringQuery is used to perform the text search via entities(matching string: String). That works well enough and results in this modal: Though, when I’m using a DynamicOptionsProvider to section my EntityPropertyQuery, it doesn’t allow for searching anymore and simply opens the sectioned list in a menu like so: How can I combine both? I’ve seen it in other apps, but can’t figure out why my code doesn’t allow to section the results and make it searchable? Any ideas? My code (simplified) struct MyIntent: AppIntent { @Parameter(title: "Meter"), optionsProvider: MyOptionsProvider()) var meter: MyIntentEntity? // … struct MyOptionsProvider: DynamicOptionsProvider { func results() async throws -> ItemCollection<MyIntentEntity> { // Get All Data let allData = try IntentsDataHandler.shared.getEntities() // Create Arrays for Sections let fooEntities = allData.filter { $0.type == .foo } let barEntities = allData.filter { $0.type == .bar } return ItemCollection(sections: [ ItemSection("Foo", items: fooEntities), ItemSection("Bar", items: barEntities) ]) } } struct MeterIntentQuery: EntityStringQuery { // entities(for identifiers: [UUID]) and suggestedEntities() functions func entities(matching string: String) async throws -> [MyIntentEntity] { // Fetch All Data let allData = try IntentsDataHandler.shared.getEntities() // Filter Data by String let matchingData = allData.filter { data in return data.title.localizedCaseInsensitiveContains(string)) } return matchingData } }
0
2
532
Mar ’25
Use UnionValue For AppIntent Parameter
I'm currently trying to use the new @UnionValue macro. From what I understood, it allows multiple types for a parameter. I created the following enum: @UnionValue enum IntentDuration { case int(Int) case duration(Measurement<UnitDuration>) } Then, I tried to use it in the following AppIntent: struct MyIntent: AppIntent { static let title: LocalizedStringResource = "intent.title" static let description = IntentDescription("intent.description") static let openAppWhenRun: Bool = true @Parameter var duration: IntentDuration @Dependency private var appManager: AppManager @MainActor func perform() async throws -> some IntentResult { // My action return .result() } } However, I get the following error from Xcode at the @Parameter line: 'init()' is unavailable Did I wrongly understand how this works? Is there another way to accept multiple types for a parameter? I didn't manage to find any docs on this.
2
0
256
Jun ’25
struggling with app automation
hi so im trying to create a simple app that has two pressable buttons that turn a spa mode on and off wishing another app so far I have the UI figured out the app works the only issue is right now when I press spa on I have setup so it opens Siri Shortcuts and enables the shortcut is there a way to make the app revert back to mine after the action is done? or is there another way to open the other app and navigate to the button within that app and enable it behind my app
0
0
303
Feb ’25
Add the ability to remove/delete chats in the ChatGPT app using shortcuts
So Recently I’ve been making shortcuts and I noticed that I can prompt chatgpt with shortcuts to add extra functionality, I like this idea but there is 1 flaw with it and that is there is no ability to remove chats automatically, I suppose this would be fine except every time the shortcut is run it creates a new chat, usually I would have made it to remove the chat after the shortcut is finished, but since I can’t the chats would pile up as there is no way of getting rid of them automatically and it would be tedious to manually delete all the chats. also sorry if I chose the wrong topic and subtopic, I couldn’t find a topic about shortcuts
1
0
433
Feb ’25
Shortcuts Automatic, App Shortcuts and FocusStatus in Playground work
Hello everyone, I’m currently developing a Playground App for the Swift Student Challenge, and its core functionality relies heavily on Shortcuts Automation, App Shortcuts, and interactions with the Focus Mode status (e.g., reading Focus Status or execute Focus Filter). Before finalizing my submission, I’d like to clarify whether these features will function as expected during the review process. Specifically: Shortcuts Automation: My app uses custom shortcuts to trigger actions within the Playground. Will reviewers be able to test these shortcuts seamlessly, or do I need to provide explicit instructions for enabling/setting them up? App Shortcuts: The app integrates system-level App Shortcuts (via App Intents). Are these supported in the test environment, and will reviewers see them during testing? Focus Status Interaction: The app dynamically responds to changes in the device’s Focus Mode (e.g., adjusting UI and function based on FocusStatus). Does the evaluation environment allow access to Focus Status data, and are there restrictions on simulating Focus Mode changes? I want to ensure these features are testable and don’t lead to unexpected issues during review. Any insights or advice from past participants, mentors, or Apple experts would be greatly appreciated! Thank you in advance for your guidance!
1
1
417
Feb ’25