We implemented AppIntents using EnumerableEntityQuery and @Dependency and we are receiving these crash reports:
AppIntents/AppDependencyManager.swift:120: Fatal error: AppDependency of type MyDependency.Type was not initialized prior to access. Dependency values can only be accessed inside of the intent perform flow and within types conforming to _SupportsAppDependencies unless the value of the dependency is manually set prior to access.
I can't post the stack because of the Developer Forums sensitive language filter :( but basically it's just a call to suggestedEntities of MyEntityQuery that calls the dependency getter and then it crashes.
My understanding was that when using @Dependency, the execution of the intent, or query of suggestedEntities in this case, would be delayed by the AppIntents framework until the dependency was added to the AppDependencyManager by me. At least that's what's happening in my tests. But in prod I'm having these crashes which I haven't been able to reproduce in dev yet.
Does anyone know if this is a bug or how can this be fixed? As a workaround, I can avoid using @Dependency and AppDependencyManager completely and make sure that all operations are async and delay the execution myself until the dependency is set. But I'd like to know if there's a better solution.
Thanks!
Automation & Scripting
RSS for tagLearn about scripting languages and automation frameworks available on the platform to automate repetitive tasks.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Here's my AppleScript:
tell application "Finder"
activate
open application file "Messages.app" of folder "Applications" of folder "System" of startup disk
end tell
I just need the step to send the message making the script automatically send the message which has already been created. This step opens the completed iMessage ready to send . I want to send it without and keyboard usage. All that is needed is the step to send
Topic:
App & System Services
SubTopic:
Automation & Scripting
Is there a way to create a data roaming or cellular profile or shortcut so that we can turn data off for certain sets of apps when we travel (and turn them all back on when we're back)?
I am developing an app that allows the user to ask it to process the clipboard contents and do something with it.
In developing a XC UI Test, I find the app stops while it waits for the user to give permission. That breaks the automation.
I tried:
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let allowButton = springboard.buttons["Allow Paste"]
But that does not work. Is there a way to tell the framework to automatically give the test permission to access the Paste clipboard (or to allow me to write tests to grant this)?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Xcode
XCTest
Testing
Swift Testing
Hi,
I am developing a music app. We are using siri media search functionality for a while. We recently had a case where siri would not provide keyword for a search.
When user speaks "Play Kid songs" (in Turkish, çocuk şarkıları çal), when I debug I see mediaSearch.mediaName is nil.
When user speaks "Play Kids" (in Turkish, çocuklar çal) a keyword is given and we can search and play related song.
Normally I would think that siri is somehow censoring the word "Kid". But when i try the same voice search in Spotify, I get a children song search result.
I've read documentations and searched web but couldnt find any similar experience.
What would be the cause, is there an extra setting for this kind of behaviour. What would be the cause or a different capability that Spotify can get a keyword out of this voice search but not us?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
SiriKit
App Intents
I have a script that stop working since Tahoe migration.
The script need to send a notification on the my mac.
The issue is this line:
osascript -e 'display notification "The task has been completed" with title "✅ My script"'
It doesn't fail (return 0), nothing in outputs, but doesn't show anything.
I check all my notification settings, but all seems to be right, I tested the configuration of iterm & script editor.
And the global ettongs of the notifications:
Hello?
Does anyone have a program to "Create Shortcuts" in Swift?
With:
Program Name:
Program Path:
Program Image:
Topic:
App & System Services
SubTopic:
Automation & Scripting
I am creating an AppIntent to be used with Shortcuts and I would like to return a flexible dictionary of values with nested structures. As far as I understand the custom AppEntity only uses the displayRepresentation to store a title and subtitle which are LocalizedStringResource. types. Although I can convert my dictionary into a string I found no way in shortcuts to be able to retrieve the original structure of it and inspect individual elements like in subsequent actions. Is there a way to do this?
Thank you in advance
Nick Karanatsios
当用户开启App自动更新后,自动更新App后,App有些功能会错乱。
1.有的会触发旧App代码功能,如旧版本有个选择框,在新版本选择框从界面移除了,但自动更新看,有的用户会还会触旧版本选择框的功能
2.数据错乱,如App录入数字6,发送到服务端变成5.4
现在发现这些问题。都是要把App删除,重新下载就可以。
请问要如何避免这样的问题。
App是有Objective-C,会不会与开启 BITCODE有关?
Topic:
App & System Services
SubTopic:
Automation & Scripting
I was looking through:
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/SAppsHandleAEs.html
And wondered how these are handled for SwiftUI
apps. What would I add or override?
Is there any way of creating complete Shortcuts automations and bundling them with my app? Specifically, I would like the user to be able to
Take a photo and open it with my app
Or take a screenshot and open it with my app
Of course I could offer a Share extension, but going through the Share menu and selecting my app there is time consuming for the user. I would like the user to be able to configure his or her action button such that it takes a new picture and opens it with my app right away.
I can, of course, offer the respective App Shortcuts and let the user combine them into a pipeline with the Take Screenshot or Take Photo system actions. However, only power users would do this. Hence, I would like to bundle this complete pipeline with my app, such that the user just has to assign his/her Action Button to this pipeline if he/she wants to use this feature.
How to go about this? I was thinking of exporting the shortcut into a file, bundling it with the app as a resource, and offering it via a Share action for the user to install it, or by sharing it on iCloud and adding the iCloud link to the UI of my app. What is the recommended approach?
Hi there,
Does anyone know how to modify this Image compressor Shortcut https://www.icloud.com/shortcuts/e13d8013598f4f33830386a956a163dd so that the image it creates has the original file name + “-pressed”?
Eg “Image_123” becomes “Image_123-pressed”
I know of the action ‘Rename file’ but can’t make it work. Any help much appreciated:)
Hi there,
Does anyone know how to modify this Image compressor Shortcut https://www.icloud.com/shortcuts/e13d8013598f4f33830386a956a163dd so that the image it creates has the original file name + “-pressed”?
Eg “Image_123” becomes “Image_123-pressed”
I know of the action ‘Rename file’ but can’t make it work. The shortcut does batch processing of images if that makes any difference.
Any help much appreciated:)
Currently, we are developing an all-in-one DualSense utility for macOS. We are exploring how to integrate shortcuts into our app. Our vision is to have the user use the native Shortcuts app to choose the controller buttons that should trigger the shortcut action, such as opening Steam, turning on audio haptics, and more.
As we explore this approach, we want to see whether we need to build the UI in our app to set the triggers or can we do this inside of Shortcuts? Can button presses recorded by our app trigger shortcuts? Can those button inputs be customized inside of Shortcuts or should we develop it into our app? And if we have it in our app, can our app see, select, and trigger shortcuts?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
macOS
Shortcuts
Intents
App Intents
Hello,
I am experiencing an issue with the App Intents framework where a parameter of type [String] (String Array) fails to persist user input in the Shortcuts app action editor.
Issue Description: When adding an item to the String Array parameter in the Shortcuts app action editor, the input text automatically clears/resets to empty within less than 1 second. This happens spontaneously while the keyboard is still active, or immediately after typing, making it impossible to input any values.
Environment:
Xcode Version: 26.2 (17C52)
iOS Version: 26.2.1
Device: iPhone 17
Code Snippet:
import AppIntents
import SwiftUI
struct TestStringArrayIntent: AppIntent {
static var title: LocalizedStringResource = "Test Array Input Bug"
static var description: IntentDescription = "Reproduces the issue where String Array input clears automatically."
// PROBLEM:
// Input for this parameter vanishes automatically < 1s after typing.
@Parameter(title: "Test Strings", default: [])
var strings: [String]
func perform() async throws -> some IntentResult & ReturnsValue<String> {
return .result(value: "Count: \(strings.count)")
}
}
Steps to Reproduce:
Build and install the app containing the code above.
Open the Shortcuts app and create a new shortcut.
Add the "Test Array Input Bug" action.
Tap the "Test Strings" parameter to add a new item.
Type any text (e.g., "Hi").
Observe: Wait for about 1 second
Observed Behavior: The text field clears itself automatically. The array remains empty ([]).
Expected Behavior: The text should remain in the field and be successfully added to the array.
**Filed as Feedback:**FB21808619
Thank you.
I'm building an automated wallpaper updater that fetches images from an API and sets them as desktop wallpaper on macOS Tahoe. The automation uses AppleScript combined with database manipulation to ensure wallpaper applies to all spaces.
Current implementation (via Apple Shortcuts):
wallpaper_path="$1"
osascript -e "tell application \"System Events\" to tell every desktop to set picture to
POSIX file \"$wallpaper_path\""
sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "UPDATE data SET space=NULL
WHERE space IS NOT NULL;" 2>/dev/null
killall -HUP Dock
Issue
First run: Works perfectly - sets wallpaper on all spaces/desktops, "Show on all spaces" is ON
After first run: "Show on all spaces" automatically toggles OFF in System Settings
Second run onwards: New wallpaper only updates on the active space, inactive spaces show old wallpaper
Expected: "Show on all spaces" should remain ON after programmatic wallpaper changes
Actual: System Settings automatically disables it, breaking subsequent updates
Tested workarounds (all failed):
UPDATE data SET space=NULL to clear per-space entries
Using every desktop instead of current desktop in AppleScript
killall Dock vs killall -HUP Dock vs killall -USR1 Dock
Clearing space_id entries from pictures table
Running DELETE FROM pictures WHERE space_id IS NOT NULL before setting
The database manipulation doesn't prevent macOS from automatically creating per-space entries
and disabling the "Show on all spaces" toggle.
Question: Is there a way to programmatically set wallpaper while preserving the "Show on all
spaces" setting on macOS Tahoe?
Environment:
macOS: Tahoe (latest)
Architecture: Apple Silicon
Use case: Daily automated wallpaper updates via Shortcuts
I'm implementing app intents for my tasks app which supports recurrence rule for tasks. I see that when creating a todo for Reminders via Siri it allows to set a recurrence rule via natural language.
Is there a built in way to receive that recurrence rule as a @Parameter in my AppIntent? If not, is it possible to receive the full user dictated text in the AppIntent:perform method so that I can use some ML model to convert the text to EKRecurrenceRule or similar?
We have an app that controls InDesign Desktop and InDesignServer via hundreds of AppleScripts. Some macOS security updates a while back dictated that we start communicating with other apps via ScriptingBridge. We couldn't afford to convert the hundreds of AppleScripts into direct ScriptingBridge nomenclature, so we opted to keep them as is and instead tell the external apps to:
[app doScript:<the script text> language:InDesignScLgApplescriptLanguage withArguments:nil undoMode:InDesignESUMScriptRequest undoName:@"blah"]
There are a handful of scripts that we did convert to direct ScriptingBridge.
There are times (and under the right circumstances, it's repeatable) when a certain script will have run perfectly dozens of times, and then it will throw errOSAInternalTableOverflow.
We create a new SBApplication for every job (which could be a single instance of Desktop or the multiple instances of Server).
Why is this error happening seemingly randomly? Is there anything we can do to work around or prevent this?
Should there be separate intents to open each supported file type? Or a single intent, and my code sniffs out the format?
When asking Siri to run a shortcut, it will spawn two processes called BackgroundShortcutRunner that do not die when the shortcut is done running. If the Siri window is on screen when I speak to have the shortcut run it does not spawn those two processes. However if the Siri window is not on screen when I speak, the Siri window appears and spawns these two processes. The two processes do not terminate once the shortcut is done running. I now have over 200 these processes since rebooting three days ago to install 26.4.
FB22015192
Topic:
App & System Services
SubTopic:
Automation & Scripting