I have an app intent that returns a file from inside the Sandbox.
With iOS 18 RC, the call to INFile results in the file being deleted, instead of the file being returned.
intentResponse.file = INFile(fileURL: fileURL, filename: fileName, typeIdentifier: nil)
This seems to happen if the file was created by an earlier Shortcut action that calls FileManager().copyItem(), but not for files created by other means.
I haven't found a reference in the developer documentation about INFile resulting in the file being deleted.
I can block FileManager() from deleting the file by setting its immutable attributes to true, but that prevents me from removing it later.
Shortcuts
RSS for tagHelp users quickly accomplish tasks related to your app with their voice or with a tap with the Shortcuts API.
Posts under Shortcuts tag
103 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
iOS 17.6.1 WatchOS 10.6.1
WatchAPP安装完毕之后,未登录,可以进入执行,提示 “未登录”
WatchAPP登录后,提示 “Apple Watch无法运行快捷指令,与App通信出现问题”
手表快捷指令,执行报错
Cannot send with an inactive account
I want to use the Shortcuts app on macOS Monterey to modify M4A/AAC audio file metadata for files that I have ripped from CD to my local Music app library.
How can I use a regular expression on track titles to replace text that matches a certain regex pattern?
I have already written the regex, I just need help with the Shortcuts app.
I've started my shortcut with a "Find Music" action connected to a "Repeat with Each" loop action.
Within the loop, I use a "Get Details of Music" action to get the title, which is passed to a "Replace Text" action using my regex.
I just don't know how to write the correct new title into the music file's title/name metadata field. I tried a "Rename File" action with type "iTunes media" to try to set the "Title" field, but the field wasn't updated either in the Music app or in the M4A/AAC file itself. I couldn't find any other actions that seemed like they might be able to modify the field.
I'd prefer a solution that goes through the Music app / its APIs, rather than directly modifying the M4A on the file system, because the latter would force me to have the Music app scan for changed files after the files we're modified.
how to register more than 10 shortcuts
使用APPIntent 的AppShortcutsProvider方式,最多只能添加10个AppShortcut,超过10个,代码编译就会报错
struct MeditationShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: StartMeditationIntent(),
phrases: [
"Start a (.applicationName)",
"Begin (.applicationName)",
"Meditate with (.applicationName)",
"Start a (.$session) session with (.applicationName)",
"Begin a (.$session) session with (.applicationName)",
"Meditate on (.$session) with (.applicationName)"
]
)
}
}
如何能做到像特斯拉APP一样
The action “bla bla” could not run because of an internal error on specific mobile only
I have tried updating shortcuts app and restart my phone but nothing works
I'm able to deep link to the Automation tab in Shortcuts App using : shortcuts://create-automation.
But I want to preselect a predefined automation (like bluetooth / nfc) and profile some parameters along with it, like
Name of the automation shortcut to select
When / Trigger point for the automation shortcut
Do / what should happen on tuning the shortcut
Thanks !
I'm trying to create an App Shortcut so that users can interact with one of my app's features using Siri. I would like to be able to turn this shortcut on or off at runtime using a feature toggle.
Ideally, I would be able to do something like this.
struct MyShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
// This shortcut is always available
AppShortcut(
intent: AlwaysAvailableIntent(),
phrases: ["Show my always available intent with \(.applicationName)"],
shortTitle: "Always Available Intent",
systemImageName: "infinity"
)
// This shortcut is only available when "myCoolFeature" is available
if FeatureProvider.shared.isAvailable("myCoolFeature") {
AppShortcut(
intent: MyCoolFeatureIntent(),
phrases: ["Show my cool feature in \(.applicationName)"],
shortTitle: "My Cool Feature Intent",
systemImageName: "questionmark"
)
}
}
}
However, this does not work because the existing buildOptional implementation is limited to components of type (any _AppShortcutsContentMarker & _LimitedAvailabilityAppShortcutsContentMarker)?.
All other attempts at making appShortcuts dynamic have resulted in shortcuts not working at all. I've tried:
Creating a makeAppShortcuts method that returns [AppShortcut] and invoking this method from within the appShortcuts
Extending AppShortcutsBuilder to support a buildOptional block isn't restricted to a component type of (any _AppShortcutsContentMarker & _LimitedAvailabilityAppShortcutsContentMarker)?
Extending AppShortcutsBuilder to support buildArray and using compactMap(_:) to return an empty array when the feature is disabled
I haven't used SiriKit before but it appears that shortcut suggestions were set at runtime by invoking setShortcutSuggestions(_:), meaning that what I'm trying to do would be possible. I'm not against using SiriKit if I have to but my understanding is that the App Intents framework is meant to be a replacement for SiriKit, and the prompt within Xcode to replace older custom intents with App Intents indicates that that is indeed the case.
Is there something obvious that I'm just missing or is this simply not possible with the App Intent framework? Is the App Intent framework not meant to replace SiriKit and should I just use that instead?
I'm working on a SwiftUI interactive widget using AppIntent. However, I want to prevent my AppIntents from appearing in the Shortcuts app. Currently, all my AppIntents are showing up in the Shortcuts app, but I only want them to be used within my widget.
Is there a way to restrict the visibility of AppIntents so they don't appear in the Shortcuts app?
Here is a simplified version of my AppIntent:
import AppIntents
struct MyWidgetIntent: AppIntent {
static var title: LocalizedStringResource = "My Widget Intent"
func perform() async throws -> some IntentResult {
// Intent logic here
}
}
I've looked into the documentation but haven't found a clear way to achieve this.
I'm trying to test the Assistant Schema Intent with the Shortcut app. However, unlike in the WWDC video (https://developer.apple.com/videos/play/wwdc2024/10133/), my Intent conforming to the Assistant Schema does not appear when I search for 'AssistantSchema'. If it doesn't appear here, does that mean this intent will not work with Siri?
I want to launch my app via shortcuts which has new automation, Then I selected NFC scanning button and run immediately. Next I selected my AppIntent, but when I get launched from a Tag, How can I get data stored in it.
Hi,
I am working on creating a EntityPropertyQuery for my App entity. I want the user to be able to use Shortcuts to search by a property in a related entity, but I'm struggling with how the syntax for that looks.
I know the documentation for 'EntityPropertyQuery' suggests that this should be possible with a different initializer for the 'QueryProperty' that takes in a 'entityProvider' but I can't figure out how it works.
For e.g. my CJPersonAppEntity has 'emails', which is of type CJEmailAppEntity, which has a property 'emailAddress'. I want the user to be able to find the 'person' by looking up an email address.
When I try to provide this as a Property to filter by, inside CJPersonAppEntityQuery, but I get a syntax error:
static var properties = QueryProperties {
Property(\CJPersonEmailAppEntity.$emailAddress, entityProvider: { person in
person.emails // error
}) {
EqualToComparator { NSPredicate(format: "emailAddress == %@", $0) }
ContainsComparator { NSPredicate(format: "emailAddress CONTAINS %@", $0) }
}
}
The error says "Cannot convert value of type '[CJPersonEmailAppEntity]' to closure result type 'CJPersonEmailAppEntity'"
So it's not expecting an array, but an individual email item. But how do I provide that without running the predicate query that's specified in the closure?
So I tried something like this , just returning something without worrying about correctness:
Property(\CJPersonEmailAppEntity.$emailAddress, entityProvider: { person in
person.emails.first ?? CJPersonEmailAppEntity() // satisfy compiler
}) {
EqualToComparator { NSPredicate(format: "emailAddress == %@", $0) }
ContainsComparator { NSPredicate(format: "emailAddress CONTAINS %@", $0) }
}
and it built the app, but failed on another the step 'Extracting app intents metadata':
error: Entity CJPersonAppEntity does not contain a property named emailAddress. Ensure that the property is wrapped with an @Property property wrapper
So I'm not sure what the correct syntax for handling this case is, and I can't find any other examples of how it's done. Would love some feedback for this.
Is there anything that can be done to speed up the execution of a Shortcut?
There is a Shortcut that many users opt to use with my app that is only effective if it runs immediately - the reality, though, is that it often takes 1-2 seconds for the Shortcut to trigger, rendering it largely useless (the Shortcut is meant to prevent users from being able to disable Screen Time in Settings).
Has anyone had success with this, and/or are there other approaches we could be taking?
I’ve two automations set.
Send a notification when battery rises above 80%
Set Always ON display off on apple watch (via Shortcuts Automation, everyday at 12 a)
For these aforementioned shortcuts I get the following errors frequently, on my Lock Screen,
Wha is INCExtensionErrorDomain error 1307 and Remote execution timed out error? And how can these errors be mitigated?
I'm getting widespread reports from users trialling iOS 17.6 public beta that Siri Shortcuts are failing whenever they enter any text that looks like a URL.
It's getting reported to me because my app happens to have an app intent with a string parameter which can contain a URL in some circumstances.
However it's easily reproducible outside of my app: just create a 2 line shortcut like the one below. If you change "This is some text" to "https://www.apple.com" the shortcut below will fail:
In iOS 17.5 entering "https://www.apple.com" works fine.
I've raised feedback on this (FB14206088) but can anyone confirm that this is indeed a bug and not some weird new feature of Shortcuts where the contents of a variable can somehow change the type of a variable?
It would be very, very bad if this were so.
I haven’t figured out a way to have my phone automatically restart between the hours of midnight and 6am when the battery reaches 100%. Is there a way to do this?
I want to implement AppIntent in my Objective-C framework, because we need to design a fast pass to certain function.
However, I create a struct inherited from AppIntent, and create a projectName-Bridging-Header.h in my framework just like I did in my project. It seems like framework don't work, I can't find it in shortcuts
It would greatly benefit the entire community if there was a "Once" button under the "automation" section that is apart of "shortcuts" app.
Currently there are 3 selections - Daily, Weekly, Monthly.
Please add a 4th selection - "Once"
I'm asking because I was told that I could do this here.
Thanks for anyone that supports this as I feel it would benefit us immensely.
I'm trying to use a custom system image for my App Shortcut:
AppShortcut(
intent: AppOpenIntent(),
phrases: ["Open \(.applicationName)"],
shortTitle: "Open App",
systemImageName: "custom.image"
)
I've added custom.image to Images.xcassets for my project, but the shortcuts icon is always blank in the Shortcuts app. Is it possible to use custom system images for app shortcuts?