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

108 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

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
421
Sep ’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
516
Sep ’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
342
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
608
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
938
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
706
Aug ’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
309
Aug ’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
761
Jul ’23
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
380
Jul ’23
add keywords to taken picture
Hi all i want to create a shortcuts task, leting you choose from a number of menu's, where the chosen items will be added as photo keywords or captations to 1 or more subsequent taken pics. the main problem is not being able to add the words, using this method: (it's the Dutch version) the other problem is that i would like to have the choise to take more pictures with a prompt. could someone help me with this problem? thanks a billion!
0
0
332
Jul ’23
AppIntentsPackage protocol with SPM package not working
Hi, I am trying to integrate the new AppIntentsPackage protocol into my application. Especially what I want to do is to create a dedicate SPM package which holds all my app intents and then share that with my widget extension for Widget intents as well as the main iOS app for powering an AppShortcutProvider. Unfortunately I run into an issue here. I have the following explanatory setup: SPM package called ProjectAppIntents iOS target My AppIntents SPM package //Package: ProjectAppIntents public struct TestAppIntent: AppIntent { public static var title: LocalizedStringResource = "TestAppIntent" @Parameter(title: "Parameter1", optionsProvider: ParameterOptionProvider()) public var parameter: String public init(parameter: String) { self.parameter = parameter } public init() { } public func perform() async throws -> some IntentResult & ReturnsValue { .result(value: 5) } } struct ParameterOptionProvider: DynamicOptionsProvider { func results() async throws -> [String] { return ["Hello", "World"] } } public struct ProjectAppIntentsPackage: AppIntentsPackage { } My iOS app // Target: iOS import ProjectAppIntents struct ProjectApp: App { var body: some Scene { WindowGroup { ContentView() } } } extension ProjectApp: AppIntentsPackage { static var includedPackages: [AppIntentsPackage.Type] = [ ProjectAppIntentsPackage.self ] } struct ProjectShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: TestAppIntent(), phrases: ["Start a \(.applicationName)"], shortTitle: "Hello World", systemImageName: "house" ) } } When I now try to compile my app, I get the following build error: 2023-06-25 09:53:47.853 appintentsnltrainingprocessor[44848:2059163] Parsing options for appintentsnltrainingprocessor 2023-06-25 09:53:47.854 appintentsnltrainingprocessor[44848:2059163] Starting AppIntents SSU YAML Generation 2023-06-25 09:53:47.868 appintentsnltrainingprocessor[44848:2059163] error: The action TestAppIntent referenced in App Shortcut does not exist Command AppIntentsSSUTraining failed with a nonzero exit code So for me it seems like the compiler cannot find the AppIntent defined in an SPM package. Am I doing something wrong here or does the AppIntentsPackage protocol not work with SPM packages ? Thanks a lot for helping !
11
3
2.8k
Oct ’23
iOS shortcut hangs with record audio if called by Siri in 16.4
Since the iOS 16.4 update on my iPhone 12 Pro I’ve been unable to run shortcuts using the record audio command, if the shortcut was called by Siri. It seems that Siri might be running it twice, as when I set the command to ask for input for its parameters I get the menu twice. When I run it from Siri, the record screen freezes and the seconds don’t count down, but when I run it from Shortcuts it works fine. Has anyone else experienced this, or have any suggestions? Thanks!
9
2
1.2k
Oct ’23