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

106 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Apple Shorcuts to check if it rained today or tomorrow dont trigger shortcut
Dear community, I am having troubles to configure an Apple Shortcut with my Eve Aqua automatic irrigation system. I want the shortcut to run every day at 9 PM, but I need it to check if it rained today or if it is going to rain tomorrow and then stop if its going to rain or was raining today. Otherwise I would need for it to trigger the Eve Aqua scene I have configured which waters the grass for 30 minutes. Does anyone know how I can accurate achieve this in a reliable way? So far I have configured "Get Current Weather at my address", also If Precipitation chance is greater than or equal to 70m, if precipitation amount is greater than or equal to 1mm". But these conditions seem to be ignored... Thanks a lot for your help! Fernando
0
0
356
Jul ’23
AppIntent is not notifying MainApp With NSUserActivity in UIKit
This is Siri Intent before iOS 16. func handle(intent: CustomIntent, completion: @escaping (CustomIntentResponse) -> Void) { completion(CustomIntentResponse(code: .continueInApp, userActivity: nil)) } This flow working fine. This is AppIntent after iOS 16. There are 2 ways to continue in app openAppWhenRun = true ForegroundContinuableIntent Protocol only works in SwiftUI But both are not notifying the main app its just opening app without activity. In SiriIntent we can notifiy Main App with completion(CustomIntentResponse(code: .continueInApp, userActivity: nil)) application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool else its start with didfinishlaunching and we can get useractivity. Is there any solution for after iOS 16 In AppIntent we can notify app and get NSUserActivity?
2
3
692
Jul ’23
shortCuts
struct MeditationShortcuts: AppShortcutsProvider { AppShortcut( intent: OCRIntent(), phrases: [AppShortcutPhrase<OCRIntent>.init("OCR识别\(AppShortcutPhraseToken.applicationName)")], shortTitle: "文字识别", systemImageName: "checklist" ) } static var shortcutTileColor: ShortcutTileColor { return .orange } } Why packaging shortcut instructions in the above way will not be displayed in the shortcut instruction app? Defining a phrase in literal terms will show, for example struct MeditationShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: OCRIntent(), phrases: ["OCR识别\(.applicationName)"], shortTitle: "文字识别", systemImageName: "checklist" ) } static var shortcutTileColor: ShortcutTileColor { return .orange } }
0
0
290
Aug ’23
EnumerableEntityQuery references AppEntity type in the singular form when it should be plural
I’m implementing App Shortcuts in my iOS app to allow you to add and find plants. In attempt to get a “Find Plants” shortcut, I created a query that conforms to EnumerableEntityQuery and set that as the defaultQuery in my PlantAppEntity. I have the typeDisplayRepresentation set to TypeDisplayRepresentation(name: "Plant", numericFormat: "\(placeholder: .int) plants"). I added a Localizable.stringsdict to the app target, added Plant and %lld plants as the header comments shows, then clicked Localize so now English is selected in the Localization section. But when I run the app then open Shortcuts and tap my app, there’s a Find Plant shortcut, but I expected it to be titled Find Plants. When I tap the info button it shows “plant” instead of “plants” in every parameter description. When you add that action to a shortcut the placeholder is All Plant, unlike similar shortcuts from Reminders and Contacts that say “All Reminders” and “All Contacts”. The action is working properly as it returns an array of plants, the only issue is it’s using the singular form of plant in places it should be plural. Have I done something wrong, am I missing anything, or is this a bug? (FB12908309)
1
0
662
Aug ’23
How to create App Shortcut just like New Note from Notes app
In iOS 17 when you search Spotlight for Notes you can see it has an App Shortcut titled New Note that simply opens the Notes app and starts composing a new note. When you open the Shortcuts app, create a new shortcut, search for and tap Notes, notice the New Note action is ONLY included at the top - it's not in the list of actions underneath. There is another intent in the list titled Create Note which will create a new note using the content you specify without opening the Notes app. I want to achieve this same thing in my app - an App Shortcut to open the app and start creating a new item, and a shortcut action to create a new item without opening the app. How can this be done? So far I have created two AppIntents, NewItem and CreateItem. My AppShortcutsProvider only includes NewItem. This works great when searching for my app in Spotlight. But when I open Shortcuts and go to add an action from my app to a shortcut, it includes Add Item at the top as an App Shortcut but also in the actions list underneath. Create Item is included in the list as well which is confusing. I don't want Add Item to be an available action because it's fairly useless to open the app and start creating an item, instead they should use Create Item to create an item in the background. Do I need to instead create a single shortcut that behaves differently in Spotlight vs Shortcuts, is that possible?
0
2
882
Aug ’23
AppShortcuts.strings ${applicationName} should not be mandatory on the localizable key : Invalid Utterance. Every App Shortcut utterance should have one '${applicationName}' in it.
Xcode 15 beta 6 : Xcode is looking for "${applicationName}" in the strings file keys instead of the value only. (it was working on Xcode 14) error : Invalid Utterance. Every App Shortcut utterance should have one '${applicationName}' in it.
3
1
563
Aug ’23
Home Screen Quick Action - Shortcut from old implementation persists
Hi. I switched my app from the old (<2018) Home Screen static Quick Actions implementation to the new one using the Info.plist. Old implementation: let shortcut1 = UIApplicationShortcutItem( type: ShortcutType.doStuff1.rawValue, localizedTitle: "title", localizedSubtitle: nil, icon: UIApplicationShortcutIcon(systemImageName: "moon"), userInfo: nil) application.shortcutItems = [shortcut1] New implementation using Info.plist: https://developer.apple.com/documentation/uikit/menus_and_shortcuts/add_home_screen_quick_actions Now ... the new shortcut items from the Info.plist appear correctly in the new app, however shortcut1 from the old version is also still there. The new code has no traces of the old code anymore! Why is that? How can I get rid of it without removing the app and reinstalling it (which would work)? Thanks,
0
0
326
Aug ’23
Tinting the SF Symbol of an AppEntity
As you can see in the following screenshot the „Water“ selection is an AppEnum which gets a nicely tinted SF Symbol. On the other hand, the „My Home“ is an AppEntity which also uses an SF Symbol, but doesn’t get the blue tint. Why? Now my question is, how can I force the tint on the AppEntity as well? I’ve defined it the following way: var displayRepresentation: DisplayRepresentation { DisplayRepresentation( title: "\(title)", image: .init(systemName: "house", isTemplate: true) ) } But even adding the isTemplate doesn’t work here …
0
0
480
Sep ’23
Can I trigger app specific shortcut using Siri on any language except English?
My concern is that I am not able to run the app specific shortcut (which is available to develop on iOS 16/ iOS 17) on any other language except English using Siri. I’m facing the issue when I say : “Siri do A” and Siri founds the similar shortcut in the iOS (not in the my app) and runs it. on English everything works well, but on Russian ( for example) I am facing the described above issue. How can I fix it?
0
0
397
Sep ’23
Unable to call code inside App Intent Extension like updateAppShortcutParameters() - Linking error
Was watching this latest WWDC 2023 video and had a question. I see about 17:20 in, they mention you can now put the shortcut provider in an app intent extension. https://developer.apple.com/videos/play/wwdc2023/10103/ This works fine by itself and I can see all my shortcuts and use siri, but as soon as I try to call into the extension from the main app in order to trigger updateAppShortcutParameters() or any other code, I get a linker error. Am I doing something obvious wrong? Note, I called it a framework, but it Is just an extension. Cant figure out how I am supposed to be calling this method. Any help is greatly appreciated! https://developer.apple.com/documentation/appintents/appshortcutsprovider/updateappshortcutparameters()?changes=_4_8 https://imgur.com/a/yDygSVJ
0
0
492
Sep ’23
.md support broken on MacOS
After I uninstalled Xcode and its CLI tools from my MacBook (Intel based, Ventura 13.5.2) the operating system seems to have forgotten how to handle Markdown files. I can still open them using VSCode or TextEdit but when I preview them using space they just show the file icon. My major issue with this is that I am using shortcuts to interact with them. They also stopped working on my MacBook exclusively. On both iPad and iPhone they still work. I appreciate any ideas on how to resolve this issue.
1
0
639
Sep ’23
App Intent incorrectly parses milliliters as megaliters in the en-GB environment
Hello, I just discovered that on iOS 17.0 (release), if Measurement<UnitVolume> is used in App Intent, the system will incorrectly parse mL (milliliters) as megaliters. They differ by 9 orders of magnitude. This issue only occurs in the English + United Kingdom regional format. Sample code: https://github.com/gongzhang/AppIntentUnitVolumeBugUnderEnGB Screen recording: https://youtu.be/rMMAHOFpPXs
1
0
400
Sep ’23
if App is open condition for shortcuts
Hello. In personal automations we have a condition "when app is open/closed". Can i use similar condition for public shortcuts? I tried to do it using "if" statement, but it hasn't "open/closed app" condition in params. Or maybe i didnt find it? For example, my case: When specified app is opened (e.g. LinkedIn), i need to set a VPN connection and when app closes VPN disconnecting Thanks for help and have a good day to all
0
0
515
Sep ’23
Persist AppIntent after Force Quit?
I have implemented an AppIntent in my app with the purpose of allowing users to set up an automation within the Shortcuts app that runs based on a boolean value in my app. It works well normally, but I've found that if my app is force quit, the Shortcut no longer works (presumably because it can't fetch the value of the boolean from my app anymore). Does anyone know how to persist this value so that the Shortcut will work regardless of whether my app is open in the background? Here is my implementation of the AppIntent: struct my_automation: AppIntent { static var title: LocalizedStringResource = "Automation Name" var isTrue = UserDefaults.standard.bool(forKey: "myVal") func perform() async throws -> some IntentResult { return .result(value: isTrue) } }
1
0
483
Oct ’23