Shortcuts

RSS for tag

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

Shortcuts Documentation

Posts under Shortcuts tag

113 Posts
Sort by:
Post not yet marked as solved
0 Replies
370 Views
Is it possible to use integer parameter in parameterized phrase? I have an app shortcut where user needs to provide an integer for the app to process it. But the phrase is not recognised by Siri. The one without integer parameter works fine. struct LogWaterShortcuts: AppShortcutsProvider { @AppShortcutsBuilder static var appShortcuts: [AppShortcut] { AppShortcut( intent: LogWaterIntent(), phrases: [ "Log Water in \(.applicationName)", "Log \(\.$quantity) Water in \(.applicationName)" ], shortTitle: "Log Water", systemImageName: "plus" ) } } Is it not possible or I am doing something wrong? If it is not possible then is there any alternative that I can use to achieve the same?
Posted
by
Post not yet marked as solved
1 Replies
604 Views
Hei, I have an issue that all our apartment homes run on custom insecure cert (which we cannot change). And customers want to make Siri commands to automate the AC with Shortcuts app. Seems like if customer tries to run the shortcut which makes a POST with headers and body to insecure URL then they get an error message "there was a problem running the shortcut". Seems like Apple Shortcuts app does not allow to make post request to insecure URLs? Is there a way to get around it? Regards, Robert
Posted
by
Post not yet marked as solved
0 Replies
587 Views
I have an app intent like the one below. If the intent is run via siri when the phone is locked then the user is asked to unlock their phone but the shortcut is interrupted. Is it possible to delay opening the app until the result dialog is returned? import AppIntents struct MyIntent: AppIntent { static var title: LocalizedStringResource = "MyApp" static var description = IntentDescription("Captures data") static var openAppWhenRun: Bool = true @Parameter(title: "The Data") var theData: String @MainActor func perform() async throws -> some IntentResult { _ = try await RESTClient.postData(theData: theData) return .result(dialog:"Thank you!") //TODO: Now try to open app } }
Posted
by
Post not yet marked as solved
11 Replies
2.3k Views
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 !
Posted
by
Post marked as solved
2 Replies
1.9k Views
I'm working on creating App Shortcuts for my app to show up in the Shortcuts app and Spotlight. One new feature this year is the option to add your apps tint color as a background, but I'm not able to get this to work. I have added the items NSAppIconActionTintColorName (String) and NSAppIconComplementingColorNames (Array?) to my info.plist file that where briefly mentioned in the WWDC23 video, but they don't seem to have any effect. Has anyone got these to work in their project?
Posted
by
Post not yet marked as solved
0 Replies
246 Views
I heavily use the macOS build in Screenshot tool. 99 % I copy partial screen to the clipboard. However, sometimes I want the clipboard to be saved as a file into a Finder window. Just like I had copied a real image file. I tried several options with Shortcuts, but it seems more complicated. This comes close, but has an error I don't understand:
Posted
by
Post not yet marked as solved
0 Replies
550 Views
Hello, I'm planning on building an app that provides instructions on how to implement Automation for a shortcut that will look for specific message content in messages, and forward it to my app. I want to understand if this method isn't a breach of Apple's terms of use, considering that I intend to have this used in scale (e.g. ~50k app users). Some things to clarify: The content that will be searched in the Messages app will be reviewed and approved by the iPhone user. The iPhone user will be required to manually approve every automation action that occurs The iPhone user will have control to remove any forwarded messages that were approved by mistake or in any case of regret. The iPhone user will be well aware of the actions he makes, and approves in terms of the process and usage of the content by app. Thank you!
Posted
by
Post not yet marked as solved
1 Replies
681 Views
I have implemented a code that answers my question with Siri, but I want to have a continuous conversation like in ChatGPT app. Can't understand documentation properly to do that. import AppIntents @available(iOS 16.0, *) struct MyAppShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: AskQuestionIntent(), phrases: [ "Ask \(.applicationName)", "Ask \(.applicationName) a question" ] ) } } @available(iOS 16, *) struct AskQuestionIntent: AppIntent { static var title: LocalizedStringResource = "Ask question" static var description = IntentDescription("Ask questions directly") @Parameter(title: "Question", requestValueDialog: "What would you like to ask?") var question: String @MainActor func perform() async throws -> some OpensIntent { return .result(opensIntent: self, dialog: IntentDialog(stringLiteral: "some result")) } } Here is How it looks like in ChatGPT: And here is my app: `
Posted
by
Post not yet marked as solved
0 Replies
628 Views
This is a very long battle trying to solve an issue with an automation I created in the Shortcuts app. I have been facing this issue on my old phone SE2 and now it's the same on my 12. I am running IOS 16.5.1 with the latest security patches/ updates. This issue has also been reported to apple support multiple times with no solution yet. I have tried restoring, deleting all apps., redownloading the Shortcuts app., Deleting the Siri Voices and redownloading them but nothing is helping! I have included Screen and Video recording for this issue for the benefit of the reader I am also explaining the problem/ challenge here in text. NOTE: I am also a VoiceOver user and have a sight impairment Created a personal automation on the Shortcuts app. When any of 2 alarms is topped, get weather, text and speak text. While creating the automation and running it to test, the automation works flawless and the Siri voice used to speak text sounds just like it should. This is covered in the first video link. The challenge: When the automation is triggered, i.e. when the alarm is stopped and the text is to be spoken; the Siri voice is all choppy and inconsistent. This is demonstrated in the second video. P.S. It happens with all English Siri voices irrespective of Language selected in the automation i.e. Australia, India, United Kingdom, United States etc. NOTE: It's the Siri voices I downloaded from: Settings/ accessibility/ Spoken content. Other voices downloaded work fine but they aren't as good and natural as Siri voices. automation how it should be working: https://www.youtube.com/watch?v=-7YxOVRf8WA automation how it works when triggered: https://www.youtube.com/watch?v=rq2rIJQV7cw&list=PL8vG-Fmt9t_lLgPAxlA8qaKVksgc9b3y6&index=2
Posted
by
Post not yet marked as solved
0 Replies
294 Views
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!
Posted
by
Post not yet marked as solved
0 Replies
320 Views
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
Posted
by
Post not yet marked as solved
0 Replies
626 Views
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?
Posted
by
Post not yet marked as solved
0 Replies
262 Views
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 } }
Posted
by
Post not yet marked as solved
1 Replies
677 Views
I am trying to implement App Shortcuts for my app. I want to implement the same as Books. I am trying to do 2 things. I want to set a custom image for each App Shortcut. I want to set custom color for the Shortcuts background like orange in the Books App Shortcuts. I am trying to implement in iOS 16. Kindly share your ideas. If at all possible, kindly share a snippet
Posted
by