Issue: CSV Headings Not Appearing in Shortcut-Generated File
I'm using an iPhone 16 Pro with iOS 18.5 and the latest Shortcuts app to log expenses into a CSV file. The shortcut works fine, except the resulting file doesn't include the column headings.
Here’s what I’ve done:
Created a file called Expenses.csv with this single header line:
Date,Price,Category,Store,Notes,Location
Saved it to both /iCloud Drive and /iCloud Drive/Shortcuts (via iCloud on my Windows PC).
My Shortcut builds the CSV line from inputs (date, price, category, etc.) and appends it to the file.
I renamed the variables only in the final “Text” block, since renaming in earlier blocks seems no longer possible in this Shortcuts version.
Despite this setup, the file doesn’t preserve the header row—it either doesn’t show up, or gets overwritten.
Goal:
Have a persistent CSV file with the correct headers once, and each new entry appended below the correct columns.
Can anyone help me figure out what I’m doing wrong?
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
We're trying to add an AppIntent to our very complex and large app that works with Siri.
What we've found through numerous different configuration attempts is that when the Siri toggle is turned off on in the Shortcuts app for our app, when we speak our phrase to Siri we get this prompt: " hasn't added support for that with Siri." with an "Open " button.
When we speak the phrase while the app is open, we get the prompt that says "Turn on "" shortcuts with Siri?" with a "Turn On" button.
When the Siri toggle is turned on for our app in the Shortcuts app, all of our phrases work as expected.
Is there some kind of configuration we're missing? There doesn't seem to be a lot of documentation. We've tried to match an example app's approach (AcceleratingAppInteractionsWithAppIntents) to no avail.
Our app intents live in an xcframework if that makes a difference, but we've also tried moving it out of xcframework without success.
This is a blocker to us shipping this feature. Thanks!
I'm soliciting you because I'm having a problem using the 3D short cut for my ios application in uikit in the AppDelegate file but it's impossible to redirect the route when the user has completely killed the application. It works as a background application. I'd like it to redirect to the searchPage search page when the application is fully closed and the user clicks on search with 3D touch.
final class AppDelegate: UIResponder, UIApplicationDelegate {
lazy var window: UIWindow? = {
return UIWindow(frame: UIScreen.main.bounds)
}()
private let appDependencyContainer = Container()
private let disposeBag = DisposeBag()
var pendingDeeplink: String?
private lazy var onboardingNavigationController: UINavigationController = {
let navigationController = UINavigationController(nibName: nil, bundle: nil)
navigationController.setNavigationBarHidden(true, animated: false)
return navigationController
}()
private func handleShortcutItem(_ shortcutItem: UIApplicationShortcutItem) {
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let window = windowScene.windows.first(where: { $0.isKeyWindow }),
let rootVC = window.rootViewController else {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { [weak self] in
self?.handleShortcutItem(shortcutItem)
}
return
}
if let presentedVC = rootVC.presentedViewController {
presentedVC.dismiss(animated: !UIAccessibility.isReduceMotionEnabled) { [weak self] in
self?.executeShortcutNavigation(shortcutItem)
}
} else {
executeShortcutNavigation(shortcutItem)
}
}
private func executeShortcutNavigation(_ shortcutItem: UIApplicationShortcutItem) {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
guard let self = self else { return }
switch shortcutItem.type {
case ShortcutType.searchAction.rawValue:
self.mainRouter.drive(to: .searchPage(.show), origin: AppRoutingOrigin())
case ShortcutType.playAction.rawValue:
self.mainRouter.drive(to: .live(channel: Channel(), appTabOrigin: AppTabOrigin.navigation.rawValue), origin: AppRoutingOrigin())
case ShortcutType.myListHistoryAction.rawValue:
self.mainRouter.drive(to: .myList(.history), origin: AppRoutingOrigin())
default:
break
}
}
}
What I've tried:
Adding delays with DispatchQueue.main.asyncAfter
Checking for window availability and rootViewController
Dismissing presented view controllers before navigation
Environment:
iOS 15+
Swift 6
Using custom router system (mainRouter)
App supports both SwiftUI and UIKit
Questions:
What's the best practice for handling shortcuts on cold launch vs warm launch?
How can I ensure the router is properly initialized before navigation?
My question is similar to https://developer.apple.com/forums/thread/757298?answerId=791343022#791343022 but the solution from there did not help me.
My app sends messages. I need it to do so when a user says to Siri: "Send message with ". When a user says so, Siri shows "Open button and says " hasn't added support for that with Siri".
The code is pretty short and must work, but it doesn't. Could you please help and explain how to add the support mentioned above? How else I can use AppIntent and register the app as one capable to send messages when asked by Siri?
import AppIntents
@main
struct MyAppNameApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
init() {
MyAppNameShortcuts.updateAppShortcutParameters()
Task {
await MyAppNameShortcuts.updateAppShortcutParameters()
}
}
}
struct SendMessageWithMyAppName: AppIntent {
static var title: LocalizedStringResource = "Send message"
static let description = IntentDescription(
"Dictate a message and have MyAppName print it to the Xcode console.")
@Parameter(title: "Message", requestValueDialog: "What should I send?")
var content: String
static var openAppWhenRun = false
func perform() async throws -> some IntentResult {
print("MyAppName message: \(content)")
await MainActor.run {
NotificationCenter.default.post(name: .newMessageReceived, object: content)
}
return .result(dialog: "Message sent: \(content)")
}
}
struct MyAppNameShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: SendMessageWithMyAppName(),
phrases: [
"Send message with \(.applicationName)"
],
shortTitle: "Send Message",
systemImageName: "message"
)
}
}
Hello, I made myself an app to track my expenses.
The most important event is when I make a purchase via apple wallet.
What happens is sometimes the values from Merchant and Amount are;
Merchant = " "
Amount = 0.0
Has anyone experienced this, is there something I can do about it ? I was thinking that sometimes maybe speed connection and service is something that might make an impact
Does anyone here know something about the topic ?
I'm trying to run sample Trails app from the documentation, unaltered.
When I do the build, I get a
Command ValidateAppShortcutStringsMetadata failed with a nonzero exit code
error. How do I debug this?
I'm trying this on Xcode 16.4.
I have a food logging app. I want my users to be able to say something like:
"Hey siri, log chicken and rice for lunch"
But appshortcuts provider is forcing me to add the name of the app to the phrase so it becomes:
"Hey siri, log chicken and rice for lunch in FoodLogApp".
After running a quick survey, I've found that many users dislike having to say the name of the app, it makes it too cumbersome.
My question is:
Is there a plan from apple 2026 so the users can converse with Siri and apps more naturally without having to say the name of the app? If so, is it already in Beta and can you point me towards it?
@available(iOS 17.0, *)
struct LogMealIntent: AppIntent {
static var title: LocalizedStringResource = "Log Meal"
static var description: LocalizedStringResource = "Log a meal"
func perform() async throws -> some IntentResult {
return .result()
}
}
@available(iOS 17.0, *)
struct LogMealShortcutsProvider: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: LogMealIntent(),
phrases: [
"Log chicken and rice for lunch in \(.applicationName)",
],
shortTitle: "Log meal",
systemImageName: "mic.fill"
)
}
}
I would like to have an AppEntity with a Property that is a Date, which is only the date, not the time. ie the equivalent of 09/14/2025, not 09/14/2025 09:00 UTC
How would I model this? How would I create an EntityPropertyQuery for this? If I add QueryProperties they have the UI in Shortcuts pick a time too.
Thanks!
In my app, when invoking a Shortcut via Siri, the
application(_:continueUserActivity:restorationHandler:)
method in AppDelegate is called twice.
When I debug, both NSUserActivity objects are identical.
However, when I run the same Shortcut by tapping it manually, the method is only called once as expected.
Has anyone experienced this issue? How can I prevent Siri Shortcuts from delivering the same NSUserActivity twice?
I want to offer the user the opportunity to add more stuff to a list in AppIntents, but nothing I've tried "loops back" to the first Siri query. Checked several LLMs and they are suggest using "requestDialog" which doesn't exist, and calling recursively my AppIntent.
Is this even possible?
I and many of my users observed the problem that the Shortcuts app seems to confuse and swap actions of different apps from the same developer. This happens after updating to iOS 26.
This breaks many Shortcuts. Deleting one of the apps or re-adding the actions sometimes seems to help.
Does anybody else observe this problem, or know how to handle this?
import AppIntents
struct MGIntents: AppIntent {
static var title = LocalizedStringResource("open app")
static var openAppWhenRun: Bool = true
func perform() async throws -> some IntentResult & ProvidesDialog {
return .result(dialog: "app open")
}
}
struct AppItentsShortcuts:AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(intent: MGIntents(),
phrases: ["\(.applicationName) Open app"],
shortTitle: "Open app",
systemImageName: "fan.desk.fill")
}
}
when use ,error more error。
when i delet openAppWhenRun ,is ok。why?
how I can do it? thank you!
My phone turns or gets connected to Beats, Aipods max 2, and sometimes the Marshall Bluetooth device but it keeps triggering the automation for “When Connected To Bluetooth” - My Car
tried deleting and recreating the automation and it’s still buggy.
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Scripting
Shortcuts
Core Bluetooth
I developed a XCode project using Flutter (v. 3.35.6).
The application basically has a IntentExtension to handle intents donation and the related business logic. We decided to go with ShortcutExtension in place of AppIntents because it fits with our app's use case (where basically we need to dynamically donate/remove intents).
We have an issue building the project, and it is due to the presence of the IntentExtension .appex file in the Build Phases --> Embed Foundation Extensions.
If we remove it , the project builds however the IntentHandling is not invoked in the Shortcuts app.
Build issue:
Generated error in the console:
Cycle inside Runner; building could produce unreliable results.
Cycle details:
→ Target 'Runner' has copy command from '/Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Products/Release-quality-iphoneos/ShortcutsExtension.appex' to '/Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Products/Release-quality-iphoneos/Runner.app/PlugIns/ShortcutsExtension.appex'
○ That command depends on command in Target 'Runner': script phase “[CP] Copy Pods Resources”
○ That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
○ That command depends on command in Target 'Runner': script phase “FlutterFire: "flutterfire upload-crashlytics-symbols"”
○ That command depends on command in Target 'Runner': script phase “FlutterFire: "flutterfire bundle-service-file"”
○ That command depends on command in Target 'Runner': script phase “Thin Binary”
○ Target 'Runner' has process command with output '/Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Products/Release-quality-iphoneos/Runner.app/Info.plist'
○ Target 'Runner' has copy command from '/Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Products/Release-quality-iphoneos/ShortcutsExtension.appex' to '/Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Products/Release-quality-iphoneos/Runner.app/PlugIns/ShortcutsExtension.appex'
Raw dependency cycle trace:
target: ->
node: ->
command: ->
node: /Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Intermediates.noindex/Runner.build/Release-quality-iphoneos/Runner.build/Objects-normal/arm64/ExtractedAppShortcutsMetadata.stringsdata ->
command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Release-quality:ExtractAppIntentsMetadata ->
node: ->
command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase10-copy-files ->
node: <Copy /Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Products/Release-quality-iphoneos/Runner.app/PlugIns/ShortcutsExtension.appex> ->
CYCLE POINT ->
command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Release-quality:Copy /Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Products/Release-quality-iphoneos/Runner.app/PlugIns/ShortcutsExtension.appex /Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Products/Release-quality-iphoneos/ShortcutsExtension.appex ->
node: ->
command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase9--cp--copy-pods-resources ->
node: /Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Products/Release-quality-iphoneos/Runner.app/GoogleMapsResources.bundle ->
command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Release-quality:PhaseScriptExecution [CP] Copy Pods Resources /Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Intermediates.noindex/Runner.build/Release-quality-iphoneos/Runner.build/Script-B728693F1F2684724A065652.sh ->
node: ->
command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase8--cp--embed-pods-frameworks ->
node: /Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Products/Release-quality-iphoneos/Runner.app/Frameworks/Alamofire.framework ->
command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Release-quality:PhaseScriptExecution [CP] Embed Pods Frameworks /Users/federico.gatti/Documents/comfort-mobile-app/apps/comfort/ios/DerivedData/Runner/Build/Intermediates.noindex/Runner.build/Release-quality-iphoneos/Runner.build/Script-1A1449CD6436E619E61D3E0D.sh ->
node: ->
command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase7-flutterfire---flutterfire-upload-crashlytics-symbols- ->
node: <execute-shell-script-18c1723432283e0cc55f10a6dcfd9e024008e7f13be1da4979f78de280354094-target-Runner-18c1723432283e
I need my application to copy some files, but using Finder. Now, I know all different methods and options to programmatically copy files using various APIs, but that's not the point here. I specifically need to use Finder for the purpose, so please, let's avoid eventual suggestions mentioning other ways to copy files.
My first thought was to use the most simple approach, execute an AppleScript script using NSUserAppleScriptTask, but that turned out not to be ideal. It works fine, unless there already are files with same names at the copying destination. In such case, either the script execution ends with an error, reporting already existing files at the destination, or the existing files can be simply overridden by adding with overwrite option to duplicate command in the script.
What I need is behaviour just like when Finder is used from the UI (drag'n'drop, copy/paste…); if there are existing files with same names at the destination, Finder should offer a "resolution panel", asking the user to "stop", "replace", "don't replace", "keep both" or "merge" (the latter in case of conflicting folders). So, I came to suspect that I could achieve such bahaviour by using Apple Events directly and passing kAEAlwaysInteract | kAECanSwitchLayer options to AESendMessage(). However, I can't figure out how to construct appropriate NSAppleEventDescriptor (nor old-style Carbon AppleEvent) objects and instruct Finder to copy files.
This is where I came so far, providing srcFiles are source files (to be copied) URLs and dstFolder destination folder (to be copied into) URL:
NSRunningApplication *finder = [[NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.finder"] firstObject];
if (!finder)
{
NSLog(@"Finder is not running.");
return;
}
NSAppleEventDescriptor *finderDescriptor = [NSAppleEventDescriptor descriptorWithBundleIdentifier:[finder bundleIdentifier]];
NSAppleEventDescriptor *dstDescriptor = [NSAppleEventDescriptor descriptorWithString:[dstFolder path]];
NSAppleEventDescriptor *srcDescriptor = [NSAppleEventDescriptor listDescriptor];
for (NSURL *url in srcFiles)
{
NSAppleEventDescriptor *fileDescriptor = [NSAppleEventDescriptor descriptorWithString:[url path]];
[srcDescriptor insertDescriptor:fileDescriptor atIndex:([srcDescriptor numberOfItems] + 1)];
}
NSAppleEventDescriptor *event = [NSAppleEventDescriptor appleEventWithEventClass:kAECoreSuite
eventID:kAEClone
targetDescriptor:finderDescriptor
returnID:kAutoGenerateReturnID
transactionID:kAnyTransactionID];
[event setParamDescriptor:srcDescriptor forKeyword:keyDirectObject];
[event setParamDescriptor:dstDescriptor forKeyword:keyAETarget];
NSError *error;
NSAppleEventDescriptor *result = [event sendEventWithOptions:(NSAppleEventSendAlwaysInteract | NSAppleEventSendCanSwitchLayer) timeout:10.0 error:&error];
The code above executes without any error. The final result descriptor is a NULL descriptor ([NSAppleEventDescriptor nullDescriptor]) and there's no error returned (by reference). However, nothing happens, Finder remains silent and the application doesn't make macOS/TCC prompt for a permission to "automate Finder".
I wonder if the approach above is correct and if I use correct parameters as arguments for all calling method/messages. I'm specially interested if passing keyAETarget is the right value in [event setParamDescriptor:dstDescriptor forKeyword:keyAETarget], since that one looks most suspicious to me. I'd really appreciate if anyone can help me with this.
I'd also like to point out that I tried the same approach outlined above with old-style Carbon AppleEvent API, using AECreateDesc(), AECreateAppleEvent(), AEPutParamDesc() and AESendMessage()… All API calls succeeded, returning noErr, but again, nothing happened, Finder remained silent and no macOS/TCC prompt for a permission to "automate Finder".
Any help is highly appreciated, thanks!
-- Dragan
When my AppShortcut phrase is:
"Go (.$direction) with (.applicationName)"
Then everything works correctly, the AppIntent correctly receives the parameter. But when my phrase is:
"What is my game (.$direction) with (.applicationName)"
The an alert dialog pops up saying:
"Hey siri what is my game tomorrow with {app name}
Do you want me to use ChatGPT to answer that?"
The phrase is obviously heard correctly, and it's exactly what I've specified in the AppShortcut. Why isn't it being sent to my AppIntent?
import Foundation
import AppIntents
@available(iOS 17.0, *)
enum Direction: String, CaseIterable, AppEnum {
case today, yesterday, tomorrow, next
static var typeDisplayRepresentation: TypeDisplayRepresentation {
TypeDisplayRepresentation(name: "Direction")
}
static var caseDisplayRepresentations: [Direction: DisplayRepresentation] = [
.today: DisplayRepresentation(title: "today", synonyms: []),
.yesterday: DisplayRepresentation(title: "yesterday", synonyms: []),
.tomorrow: DisplayRepresentation(title: "tomorrow", synonyms: []),
.next: DisplayRepresentation(title: "next", synonyms: [])
]
}
@available(iOS 17.0, *)
struct MoveItemIntent: AppIntent {
static var title: LocalizedStringResource = "Move Item"
@Parameter(title: "Direction")
var direction: Direction
func perform() async throws -> some IntentResult {
// Logic to move item in the specified direction
print("Moving item \(direction)")
return .result()
}
}
@available(iOS 17.0, *)
final class MyShortcuts: AppShortcutsProvider {
static let shortcutTileColor = ShortcutTileColor.navy
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: MoveItemIntent()
, phrases: [
"Go \(\.$direction) with \(.applicationName)"
// "What is my game \(\.$direction) with \(.applicationName)"
]
, shortTitle: "Test of direction parameter"
, systemImageName: "soccerball"
)
}
}
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
SiriKit
App Intents
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!
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