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!
Intents
RSS for tagShare intents from within an app to drive system intelligence and show the app's actions in the Shortcuts app.
Posts under Intents tag
84 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
import AppIntents
struct AddTodoIntent: AppIntent {
static var title: LocalizedStringResource = "Add Todo"
static var openAppWhenRun: Bool = true
func perform() async throws -> some IntentResult & ProvidesDialog {
.result(dialog: "New todo added successfully.")
}
}
struct ViewTodosIntent:AppIntent {
static var title: LocalizedStringResource = "View Todos"
func perform() async throws -> some IntentResult & ProvidesDialog {
.result(dialog: "Here are your todos...")
}
}
struct TodoAppShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: AddTodoIntent(),
phrases: ["\(.applicationName) Add a new todo"],
shortTitle: "New Todo",
systemImageName: "plus.circle"
)
AppShortcut(
intent: ViewTodosIntent(),
phrases: ["\(.applicationName) Show my todoso"],
shortTitle: "Show todos",
systemImageName: "plus.app"
)
}
}
when we used, it wrong
How did i can do it success?
I have added an "App Intents Extension" target to my main application in macOS. This generated the below two files:
TWAppIntent.swift
import AppIntents
struct TWAppIntent: AppIntent {
static var title: LocalizedStringResource = "TWAppIntentExtension"
static var parameterSummary: some ParameterSummary {
Summary("Get information on \(\.$TWType)")
}
//launch app on running action
static var openAppWhenRun: Bool = true
// we can have multiple parameter of diff types
@Parameter(title: "TWType")
var TWType: String
func perform() async throws -> some IntentResult & ReturnsValue<String> & ProvidesDialog {
return .result(value: TWType, dialog: "Logged break.")
}
}
TWAppIntentExtension.swift
import AppIntents
@main
struct TWAppIntentExtension: AppIntentsExtension {
}
I m able to build the extension target and I my intent action is available in the shortcuts app. However, on launching a shortcut with the above created intent action. I m getting the below popups:
I have identified what is causing this error. Setting the openAppWhenRun to true is causing this error. I don't get this when it is set to false. This property is supposed to launch the application, but can someone help me understand why is it happening? This is only causing the error when using this property for AppIntent Extension and not for In app handling for the AppIntent.
Can we not launch our application from AppIntent extension?
When I set Alarm with fixed schedule(Alarm.Schedule.fixed(date))
LiveActivityIntent just work inconsistently
it sometimes call perfrom but cannot call other's
such as NotificationCenter.default.post
it just work fine with relativeSchedule but not for fixed schedule
i want to know why it happen
tested code is under below
struct StopIntent: LiveActivityIntent {
static var supportedModes: IntentModes = [.foreground(.immediate)]
func perform() throws -> some IntentResult {
guard let id = UUID(uuidString: alarmID) else {
NotificationCenter.default.post(name: .Alarm.stoped, object: alarmDataString)
throw TestAlarmManager._Error.badAlarmID
}
Task { @MainActor in
try TestAlarmManager.shared.stopAlarm(id)
NotificationCenter.default.post(name: .Alarm.stoped, object: alarmDataString)
}
return .result()
}
static var title: LocalizedStringResource = "Stop"
static var description = IntentDescription("Stop an alert")
@Parameter(title: "alarmID")
var alarmID: String
@Parameter(title: "alarmDataString")
var alarmDataString: String
init(alarmID: UUID, alarmDataString: String) {
self.alarmID = alarmID.uuidString
self.alarmDataString = alarmDataString
}
init() {
self.alarmID = ""
self.alarmDataString = ""
}
}
Hi, I have AppShortcutsProvider in my app target(not as a separate extension) to support Siri command. It is working perfectly in English, but I would also like to add a localisation on it as my app supports multiple languages.
struct MyShortcuts: AppShortcutsProvider {
static let shortcutTileColor: ShortcutTileColor = .grape
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: NextClassAppIntents(),
phrases: [
"What is my next class in \(.applicationName)?",
"What's the next class in \(.applicationName)?",
"Next class in \(.applicationName)."
],
shortTitle: "Next Class",
systemImageName: "calendar.badge.clock"
)
}
}
Xcode String Catalog was doing great jobs, It also detected shortTitle automatically and added that to the Catalog. However, I don't see localisation for those phrases anywhere in the String Catalog and when I try to use String(localized: ), compiler gives me an error.
How can I properly localise AppShortcutPhrase?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Shortcuts
Localization
Intents
App Intents
I'm currently testing this on a physical device (12 Pro Max, iOS 26). Through shortcuts, I know for a fact that I am able to successfully trigger the perform code to do what's needed. In addition, if I just tell siri the phrase without my unit parameter, and it asks me which unit, I am able to, once again, successfully call my perform. The problem is any of my phrases that I include my unit, it either just opens my application, or says "I can't understand"
Here is my sample code:
My Entity:
import Foundation
import AppIntents
struct Unit: Codable, Identifiable {
let nickname: String
let ipAddress: String
let id: String
}
struct UnitEntity: AppEntity {
static var typeDisplayRepresentation: TypeDisplayRepresentation {
TypeDisplayRepresentation(
name: LocalizedStringResource("Unit", table: "AppIntents")
)
}
static let defaultQuery = UnitEntityQuery()
// Unique Identifer
var id: Unit.ID
// @Property allows this data to be available to Shortcuts, Siri, Etc.
@Property var name: String
// By not including @Property, this data is NOT used for queries.
var ipAddress: String
var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(
title: "\(name)"
)
}
init(Unit: Unit) {
self.id = Unit.id
self.ipAddress = Unit.ipAddress
self.name = Unit.nickname
}
}
My Query:
struct UnitEntityQuery: EntityQuery {
func entities(for identifiers: [UnitEntity.ID]) async throws -> [UnitEntity] {
print("[UnitEntityQuery] Query for IDs \(identifiers)")
return UnitManager.shared.getUnitUnits()
.map { UnitEntity(Unit: $0) }
}
func suggestedEntities() async throws -> [UnitEntity] {
print("[UnitEntityQuery] Request for suggested entities.")
return UnitManager.shared.getUnitUnits()
.map { UnitEntity(Unit: $0) }
}
}
UnitsManager:
class UnitManager {
static let shared = UnitManager()
private init() {}
var allUnits: [UnitEntity] {
getUnitUnits().map { UnitEntity(Unit: $0) }
}
func getUnitUnits() -> [Unit] {
guard let jsonString = UserDefaults.standard.string(forKey: "UnitUnits"),
let data = jsonString.data(using: .utf8) else {
return []
}
do {
return try JSONDecoder().decode([Unit].self, from: data)
} catch {
print("Error decoding units: \(error)")
return []
}
}
func contactUnit(unit: UnitEntity) async -> Bool {
// Do things here...
}
}
My AppIntent:
import AppIntents
struct TurnOnUnit: AppIntent {
static let title: LocalizedStringResource = "Turn on Unit"
static let description = IntentDescription("Turn on an Unit")
static var parameterSummary: some ParameterSummary {
Summary("Turn on \(\.$UnitUnit)")
}
@Parameter(title: "Unit Unit", description: "The Unit Unit to turn on")
var UnitUnit: UnitEntity
func perform() async throws -> some IntentResult & ProvidesDialog {
//... My code here
}
}
And my ShortcutProvider:
import Foundation
import AppIntents
struct UnitShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: TurnOnUnit(),
phrases: [
"Start an Unit with \(.applicationName)",
"Using \(.applicationName), turn on my \(\.$UnitUnit)",
"Turn on my \(\.$UnitUnit) with \(.applicationName)",
"Start my \(\.$UnitUnit) with \(.applicationName)",
"Start \(\.$UnitUnit) with \(.applicationName)",
"Start \(\.$UnitUnit) in \(.applicationName)",
"Start \(\.$UnitUnit) using \(.applicationName)",
"Trigger \(\.$UnitUnit) using \(.applicationName)",
"Activate \(\.$UnitUnit) using \(.applicationName)",
"Volcano \(\.$UnitUnit) using \(.applicationName)",
],
shortTitle: "Turn on unit",
systemImageName: "bolt.fill"
)
}
}
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
Siri and Voice
Intents
App Intents
Hi there,
I successfully created an AppIntent for our app, and when I had it in the same target as our main app it showed up fine in the shortcuts app.
Then I realized that many of the new System Control widgets introduced in iOS 18 (e.g. lockscreen, control center) live in the widget extension target, but they also need to reference that same AppIntent. So to fix this, I thought I'd migrate out the code into it's own SPM package that both the WidgetExtension and the Main App processes can reference. However, after doing that and rebuilding, the intent no longer shows up in the Shortcuts app. Furthermore, my AppShortcutsProvider class now has this error when trying to define the list of appShortcuts:
App Intent <name> should be in the same target as AppShortcutsProvider
Is this intended, and if so, how do we reference the same AppIntent across multiple targets?
So I'm developing an ios application which should be showing shortcuts, but its not. I'm not sure how to debug why the functionality isnt working.
Believe I'm correctly calling AppShortcutsProvider's updateAppShortcutParameters, but I dont see any errors in the console showing me a problem.
And in fact, I made a simplified just swift version that works before I tried to integrate it into a more complex project.
But now I'm at a loss as to what is going wrong or what debug tools I can use to figure it out. Any help would be appreciated.
When building my project I see:
025-08-18 14:07:49.371 appintentsmetadataprocessor[57506:35387547] Starting appintentsmetadataprocessor export
2025-08-18 14:07:49.414 appintentsmetadataprocessor[57506:35387547] Writing Metadata.appintents
2025-08-18 14:07:49.414 appintentsmetadataprocessor[57506:35387547] Metadata root: /Users/jpetersen/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtnhxevagfkzsjdavesziaqrwisr/Build/Products/ReleaseForRunning-iphoneos/UnityFramework.framework/Metadata.appintents
AppIntentsSSUTraining (in target 'UnityFramework' from project 'Unity-iPhone')
cd /Users/jpetersen/no_doc_repos/payments_ios_investigation/SpotlightSearch/client/Build
/Applications/Xcode_16.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/appintentsnltrainingprocessor --infoplist-path /Users/jpetersen/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtnhxevagfkzsjdavesziaqrwisr/Build/Products/ReleaseForRunning-iphoneos/UnityFramework.framework/Info.plist --temp-dir-path /Users/jpetersen/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtnhxevagfkzsjdavesziaqrwisr/Build/Intermediates.noindex/Unity-iPhone.build/ReleaseForRunning-iphoneos/UnityFramework.build/ssu --bundle-id com.unity3d.framework --product-path /Users/jpetersen/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtnhxevagfkzsjdavesziaqrwisr/Build/Products/ReleaseForRunning-iphoneos/UnityFramework.framework --extracted-metadata-path /Users/jpetersen/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtnhxevagfkzsjdavesziaqrwisr/Build/Products/ReleaseForRunning-iphoneos/UnityFramework.framework/Metadata.appintents --archive-ssu-assets
2025-08-18 14:07:49.436 appintentsnltrainingprocessor[57507:35387550] Parsing options for appintentsnltrainingprocessor
2025-08-18 14:07:49.437 appintentsnltrainingprocessor[57507:35387550] Starting AppIntents SSU YAML Generation
2025-08-18 14:07:49.444 appintentsnltrainingprocessor[57507:35387550] Training 'Start ${+applicationName}' for English
2025-08-18 14:07:49.444 appintentsnltrainingprocessor[57507:35387550] Training 'Play ${ShortcutEntity}|Play ${ShortcutEntity} on ${+applicationName}' for English
2025-08-18 14:07:49.444 appintentsnltrainingprocessor[57507:35387550] Training Negative Phrases '' for English
2025-08-18 14:07:49.444 appintentsnltrainingprocessor[57507:35387550] Application name 'UnityFramework' for English
2025-08-18 14:07:49.449 appintentsnltrainingprocessor[57507:35387550] Generated AppIntents SSU YAML files in file:///Users/jpetersen/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtnhxevagfkzsjdavesziaqrwisr/Build/Intermediates.noindex/Unity-iPhone.build/ReleaseForRunning-iphoneos/UnityFramework.build/ssu/
2025-08-18 14:07:49.449 appintentsnltrainingprocessor[57507:35387550] Copied AppIntents SSU YAML files to file:///Users/jpetersen/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtnhxevagfkzsjdavesziaqrwisr/Build/Products/ReleaseForRunning-iphoneos/UnityFramework.framework/Metadata.appintents/
So I think it should be making the required app intent data :shrug:
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!
I donate INPlayMediaIntent to systerm(donate success), but not show in control center
My code is as follows
let mediaItems = mediaItems.map { $0.inMediaItem }
let intent = if #available(iOS 13.0, *) {
INPlayMediaIntent(mediaItems: mediaItems,
mediaContainer: nil,
playShuffled: false,
playbackRepeatMode: .none,
resumePlayback: true,
playbackQueueLocation: .now,
playbackSpeed: nil,
mediaSearch: nil)
} else {
INPlayMediaIntent(mediaItems: mediaItems,
mediaContainer: nil,
playShuffled: false,
playbackRepeatMode: .none,
resumePlayback: true)
}
intent.suggestedInvocationPhrase = "播放音乐"
let interaction = INInteraction(intent: intent, response: nil)
interaction.donate { error in
if let error = error {
print("Intent 捐赠失败: \(error.localizedDescription)")
} else {
print("Intent 捐赠成功 ✅")
}
}
When my Intents extension resolves an INStartCallIntent and returns .continueInApp while the device is locked, the call does not proceed unless the user unlocks the device. After unlocking, the app receives the NSUserActivity and CallKit proceeds normally.
My expectation is that the native CallKit outgoing UI should appear and the call should start without requiring unlock — especially when using AirPods, where attention is not available.
Steps to Reproduce
Pair and connect AirPods.
Lock the iPhone.
Start music playback (e.g. Apple Music).
Place the phone face down (or cover Face ID sensors so attention isn’t available).
Say: “Hey Siri, call Tommy with DiscoMonday(My app name).”
Observed Behavior
Music mutes briefly.
Siri says “Calling Tommy with DiscoMonday.”
Lock screen shows “Require Face ID / passcode.”
After several seconds, music resumes.
The app is not launched, no NSUserActivity is delivered, and no CXStartCallAction occurs.
With the phone face up, the same phrase launches the app, triggers CXStartCallAction, and the call proceeds via CallKit after faceID.
Expected Behavior
From the lock screen, Siri should hand off INStartCallIntent to the app, which immediately requests CXStartCallAction and drives the CallKit UI (reportOutgoingCall(...startedConnectingAt:) → ...connectedAt:), without requiring device unlock, regardless of orientation or attention availability when AirPods are connected.
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
iOS
Siri and Voice
Intents
CallKit
I'm a bit confused as to what we're supposed to be doing to support starting a workout using Siri in iOS/watchOS 26. On one hand, I see a big push to move towards App Intents and shortcuts rather than SiriKit. On the other hand, I see that some of the things I would expect to work with App Intents well... don't work. BUT - I'm also not sure it isn't just developer error on my part.
Here are some assertions that I'm hoping someone more skilled and knowledgable can correct me on:
Currently the StartWorkoutIntent only serves the Action button on the Watch Ultra. It cannot be used to register Shortcuts, nor does Siri respond to it.
I can use objects inherited from AppIntent to create shortcuts, but this requires an additional permission to run a shortcut if a user starts a workout with Siri.
AppIntent shortcuts requires the user to say "Start a workout in " - if the user leaves out the "in " part, Siri will not prompt the user to select my app.
If I want to allow the user to simply say "Start a Workout" and have Siri prompt the user for input as to which app it should use, I must currently use the older SiriKit to do so.
Are these assertions correct - or am I just implementing something incorrectly?
Using the latest Xcode 26 beta for what it is worth.
Topic:
App & System Services
SubTopic:
Health & Fitness
Tags:
Siri and Voice
SiriKit
Intents
App Intents
Hi,
I'm migrating my project from the old .strings files to String Catalogs (.xcstrings files). Everything is migrating over fine except for my custom intents. Right now the localization files for my custom intents all live "under" the definition file like so:
But there is no option to migrate to a string catalog. I even tried removing the localization files, and re-adding them using the "Localize..." button, but that just creates the old .strings files, not the new string catalog.
Is this not supported yet for intents definitions? I can't find any documentation about this. It would be a real shame to have part of my app on string catalogs and this one piece on the old Localizable.strings format.
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.
The execution of the shortcut command is abnormal.
An App Intents was created through xcode, a test example was written, and an exception was executed.
error: couldn`t communicate with a helper application.
log:
Shortcut <WFWorkflow: 0x600003008b40, name: Test, actions: 1> failed with error Error Domain=NSCocoaErrorDomain Code=4097 "connection to service created from an endpoint" UserInfo={NSDebugDescription=connection to service created from an endpoint, WFActionIndex=0}.
-[WFBackgroundShortcutRunner callWorkflowRunningCompletionBlockWithResult:] Workflow Did Finish: Calling Completion Block
-[WFBackgroundShortcutRunner listener:shouldAcceptNewConnection:]_block_invoke XPC connection invalidated
-[WFBackgroundShortcutRunnerStateMachine invalidateWithReason:] connection invalidated/interrupted while finishing shortcut or exiting runner. Exiting should already be in process, not transitioning.
-[WFBackgroundShortcutRunner unaliveProcess]_block_invoke_2 Exiting process
Consider the following in an AppIntent:
struct TestIntent: AppIntent {
static let title: LocalizedStringResource = "Test Intent"
static var parameterSummary: some ParameterSummary {
Summary("Test") {
\.$options
}
}
enum Option: Int, CaseIterable, AppEnum {
case one
case two
case three
case four
case five
case six
static let typeDisplayRepresentation: TypeDisplayRepresentation =
TypeDisplayRepresentation(
name: "Options"
)
static let caseDisplayRepresentations: [Option: DisplayRepresentation] = [
.one: DisplayRepresentation(title: "One"),
.two: DisplayRepresentation(title: "Two"),
.three: DisplayRepresentation(title: "Three"),
.four: DisplayRepresentation(title: "Four"),
.five: DisplayRepresentation(title: "Five"),
.six: DisplayRepresentation(title: "Six"),
]
}
@Parameter(title: "Options", default: [])
var options: [Option]
@MainActor
func perform() async throws -> some IntentResult {
print(options)
return .result()
}
}
In Shortcuts, this will turn into a dropdown where you can check multiple Option values. However, when perform() is called, options will be an empty array regardless of what the user selects. This is observed on both iOS 18.5 and macOS 15.5. However, on iOS 26.0 beta and macOS 26.0 beta, the issue seems to be resolved and options contains all the checked options. However, we do back deploy to current/previous iOS/macOS versions. How can we provide a multiple choice selection of fixed values on these older versions?
I developed a shortcut feature for my app using the AppIntents framework, which can display a maximum of 10 shortcuts in the Shortcuts app. However, I've noticed that apps like Tesla and Porsche have a significantly larger number of shortcuts, far exceeding 10. After searching online, I found that they might be using Intent Extensions and the SiriKit framework. I customized an Intent through SiriKit, checked the option for "Intent is user-configurable in the Shortcuts app" and "Add to Siri." I can find this shortcut when I search for it, but it does not appear on the homepage or under the app category. Is there any way to resolve this?
Hello,
I’m working on integrating SiriKit with my music app using INPlayMediaIntent. My app is live on TestFlight, and the Siri command is being recognized, but mediaItems is always empty in my Intent
Demo Project
When we use the "Find All Reminders" shortcut, there's these two filters "Is Completed and "Is Not Completed".
When I implement this in my app, the best I could get is just "Completed" and "Not Completed", I can't figure out how to add the "Is" in front.
In my entity:
@Property(title: "Completed")
var completed : Bool
In the EntityPropertyQuery:
static var properties = QueryProperties {
Property(\GTDItemAppEntity.$list) {
EqualToComparator { NSPredicate(format: "list.uuid = %@", $0.id as NSUUID) }
}
Property(\GTDItemAppEntity.$text) {
ContainsComparator { NSPredicate(format: "text CONTAINS[cd] %@", $0) }
EqualToComparator { NSPredicate(format: "text = %@", $0) }
}
Property(\GTDItemAppEntity.$completed) {
EqualToComparator { NSPredicate(format: $0 ? "completed = YES" : "completed = NO") }
}
}
If I change the property to
@Property(title: "Is Completed")
var completed : Bool
Then it will show as "Is Completed" and "Not Is Completed" in the filter!
Reminder:
My App:
I'm making an app that can have locations and links shared to it. I have gotten the share intent working for text and urls with:
NSExtensionActivationSupportsWebURLWithMaxCount: 1
NSExtensionActivationSupportsWebPageWithMaxCount: 1
NSExtensionActivationSupportsText: true
in Info.plist of the share extension. I am able to share Google Maps locations and safari websites. However, my app does not appear when I share a location on Apple Maps.
I also tried the other options in the docs (https://developer.apple.com/documentation/bundleresources/information-property-list/nsextension/nsextensionattributes/nsextensionactivationrule) as well without success. When I share a location (i.e. a shop) in Apple Maps, it looks like a link but perhaps its something else?
Does anyone know how to get an app to come up in the share menu of an Apple Maps location?
Thanks!