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

109 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

iOS Shortcuts: will a “Time of Day” personal automation run if the phone’s not been picked up for a few hours?
I want to use use my iPhone to make a daily call to a web URL; much like a cron job if I had a home server. In theory, this should be so simple: Open iOS Shortcuts app Go to the Automation tab Tap the ➕ icon Choose Create Personal Automation Choose Time of Day Set a time and choose next Use the “Get Contents of URL” action in the “Web Requests” section Disable “Ask Before Running” ✅ The above works great if I set the time of day to something like 9am, when I will likely be using my phone. ❌ It never runs if I set the time of day to 6am when: I am still asleep (so the phone hasn’t been picked up for 6–8 hours) The phone is on charge and connected to WiFi Do not disturb is enabled (note: I have tried disabling “Do not disturb” without success) My theory is perhaps if the phone is inactive for x time then daily automations won’t run but hoping someone has a definitive answer. Thank you!
3
0
12k
Jun ’23
Can’t enforce safari as default browser
I would like to know on a mdm managed supervised device, how to force use Safari if a user has non-safari browser set as default. can enforcing safari for a domain or web clip be done? even shortcuts now, when using safari it opens whatever is set as default browser. Ironically if same simple shortcut of open URL with Chrome is created it opens with Chrome, regardless if default browser is set to firefox for example this default browser setting is great for personal use but cause issues now for corporate use for me anybody else figure this out? Also affects certificates for our managed devices
2
0
2.1k
Aug ’23
Supporting In-App SiriKit Media Intents in watchOS
I was trying out SiriKit Media Intents and found that with iOS 14, Media Intents can be handled in-app instead of using an extension. Given my current project structure, in-app intent handling suits my purpose better than handling it in an extension. But my question is about how this intent will be handled in a watchOS app? Is in-app Intent Handling supported on watchOS as well (if yes, are there any examples that I can refer to)? If not, can I create an extension for Media Intents and trigger it for watchOS while triggering the in-app handling for iOS alone? Please share if I have missed to read through some documentation / reference that solves this problem.
1
0
965
Nov ’23
Can't run Shortcuts scripts (e.g. Run Shell Script) on macOS
Hi! I'm exploring Shortcuts on macOS, and trying to use 'Run Shell Script' in my shortcut, but it terminates with an error 'This shortcut cannot be run because this action is a scripting action and your Shortcuts security settings don’t allow you to run scripting actions'. 'Allow Running Scripts' is enabled, but the shortcut is still not working. What am I doing wrong?
3
4
3.2k
Jun ’23
How Can I run an automation on SMS messages that are coming from my Bank
I would like to perform certain actions when I receive messages from the Bank. There is an option in shortcuts to run the automation when receiving messages from certain contacts. The problem is that I can't store the bank in my contacts as they do not have a phone number or something. I want to achieve this goal in any possible way. What I have tried is to store - their contact - in my contacts so that I will be able to set up the automation. When I tried to store iPhone just shows me the prompt to create a contact with NO values whatsoever. SO it will just be an empty contact. Any ideas how on how I can achieve that?
3
2
2.3k
Sep ’23
App Shortcut "Couldn't find AppShortcutsProvider"
I am trying to create a shortcut following "Implement App Shortcuts With App Intents" talk from WWDC2022. The below is my MWE. In a standalone app, this can be extended and behave like the video. Adding this code to my main app, makes the shortcut show up within the Shortcuts app, but if I click on it, it pops up an alert saying Error Domain=LNActionForAutoShortcutPhraseFetchError Code=1 "Couldn't find AppShortcutsProvider" UserInfo={NSLocalizedDescription=Couldn't find AppShortcutsProvider} My main app has several targets, so I suppose I need to establish which one is the shortcuts provider, but I cannot find any reference to how to do this in the documents. Via Siri, the shortcut command is not recognised at all. import AppIntents import SwiftUI struct DoSomething: AppIntent {  static var title: LocalizedStringResource = "Do something"  func perform() async throws -> some IntentResult {   return .result()  }  static var openAppWhenRun: Bool = false } struct MyShortcuts: AppShortcutsProvider {  @AppShortcutsBuilder  static var appShortcuts: [AppShortcut] {   AppShortcut(    intent: DoSomething(),    phrases: ["Do Something in \(.applicationName)"],    systemImageName: "books.vertical.fill"   )  } }
5
1
2.2k
Sep ’23
Airplane mode with shortcuts not mirroring
Hello I have a shortcut that, among other things, triggers airplane mode on. This however only works on the device i activate the shortcut on. So if i activate it from my watch, my watch goes into airplane mode, but not my phone. Same the other way around. If i turn on airplane mode manually (control center) it does mirror my other devices. I would like the shortcut to work the same way as manual activation. Can anyone help me with that?
3
0
664
Sep ’23
Append Note in Shortcuts
Hi I am trying to create an Apple shortcut in notes where it creates a note with the current date and then appends text to the note below the date. There is already a shortcut on the Gallery “New Note with Date” which is supposed to do this. However, when running the shortcut, it creates the note with date in the background, then asks for what the note needs to say, then a sheet with all recent notes created pops up and you have to select which note the appended text has to be saved to. My question is, is there a way to create the note with the date and append the text to that note automatically? thanks
1
0
1.1k
Oct ’23
IntentDonationManager not donating Shortcuts
if #available(iOS 16.0, *) {       print("donated")       let intent = BasicIntent()       IntentDonationManager.shared.donate(intent: intent)    } Trying to test if donations work with the new App Intents framework. Donating the shortcut once a user taps a button. The shortcut is not appearing on the lock screen. Everything else is working as expected. The Shortcut is appearing in the Shortcuts App and is working via Siri. In developer settings I have Display Recent Shortcuts -> On Display Donations on Lock Screen -> On Allow Any domain -> On Allow Unverified sources -> On Running iOS 16.2, iPhone 11.
4
2
1.6k
Sep ’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.1k
Oct ’23
Appintent: openAppWhenRun breaks shortcut when phone is locked
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 } }
0
0
619
Jun ’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.5k
Oct ’23
Unable to set the new App Tint Color options for App Shortcuts
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?
2
4
2.1k
Jul ’23
Apple terms of use for Automation/Shortcuts regarding messages
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!
0
0
598
Jul ’23
OpensIntent. How to make AppIntents work like in ChatGPT app?
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: `
1
1
733
Jul ’23