App Intents

RSS for tag

Extend your app’s custom functionality to support system-level services, like Siri and the Shortcuts app.

App Intents Documentation

Posts under App Intents tag

159 Posts
Sort by:
Post not yet marked as solved
2 Replies
72 Views
Currently I am trying to create some shortcuts for my iOS 17 app. The AppIntent looks like this: class PostClass{ public init() { let url = URL(string: "http://myurl")! var request = URLRequest(url: url) request.httpMethod = "POST" struct Message: Encodable { let device_type: String } let message = Message( device_type: "device" ) let data = try! JSONEncoder().encode(message) request.httpBody = data request.setValue( "application/json", forHTTPHeaderField: "Content-Type" ) self.request = request } } var activateDevice = PostClass() @available(iOS 17, *) struct ActivateIntent: AppIntent { static let title: LocalizedStringResource = "Activate" func perform() async throws -> some IntentResult { let task = URLSession.shared.dataTask(with: activateDevice.request) { data, response, error in let statusCode = (response as! HTTPURLResponse).statusCode if statusCode == 200 { print("SUCCESS") } else { print("FAILURE") } } task.resume() return .result() } } Unfortunately, the shortcut throws an error after every second execution. I looked into the ips-file and saw the following traceback: Thread 2 Crashed: 0 Runner 0x1028ddd30 closure #1 in ActivateIntent.perform() + 388 1 CFNetwork 0x1a6f39248 0x1a6f2a000 + 62024 2 CFNetwork 0x1a6f57210 0x1a6f2a000 + 184848 3 libdispatch.dylib 0x1adced13c _dispatch_call_block_and_release + 32 4 libdispatch.dylib 0x1adceedd4 _dispatch_client_callout + 20 5 libdispatch.dylib 0x1adcf6400 _dispatch_lane_serial_drain + 748 6 libdispatch.dylib 0x1adcf6f64 _dispatch_lane_invoke + 432 7 libdispatch.dylib 0x1add01cb4 _dispatch_root_queue_drain_deferred_wlh + 288 8 libdispatch.dylib 0x1add01528 _dispatch_workloop_worker_thread + 404 9 libsystem_pthread.dylib 0x201dd4f20 _pthread_wqthread + 288 10 libsystem_pthread.dylib 0x201dd4fc0 start_wqthread + 8 Is there any way to locate the error with these information? Has it something to do with the fact that my code is not thread-safe? Or is there any internal bug? Grateful for any help, thanks in advance!
Posted
by alex_hsv.
Last updated
.
Post not yet marked as solved
0 Replies
94 Views
Description: Problem Statement: State the problem clearly: The Siri Intent for the "Next","Previous","Repeat" command is not working as expected within the Speech Framework. Steps to Reproduce: Provide a detailed description of the steps to reproduce the issue. For example: Open the Speech Framework application. Tap on the Siri button to activate voice input. Say "Next" to trigger the intended action. Observe that the action is not executed correctly. IN Our Demo App: Steps of my demo application as below: Open SIRI Speak: Check In Response: Open dialog as below: What user wants? One 2) Next 3) Yes 4) Goodbye Speak: Next In Response: SIRI repeat same dialog (Step: 2) 3) Speak: Yes, or One or Goodbye In Response: SIRI goes to next dialog. Expected Behavior: Should be get "Next" Value in siri kit intent or app intent. Actual Behavior: But it give previous user input key word give in siri kit intent and recuresively repeat dialog in app intent. Device versions and Region and Language: Device model: IPhone 11 and OS version: 17.4.1 Region: Us and Language: English(US) Impact: User Cant use Iterative dialog in one context. Additional: How Different command work on app intent and siri kit intent on diffrent diffrent device. you can follow No vise in order. || No || Diffrent Device test on Diffrent sinario || SiriKit intent || app Intent || | 1 | ISG iPhone 11 - Next | Not | Not | | 2 | ISG iPhone 11 - Yes | Not | Yes (But Using Enum) | | 3 | ISG iPhone 11 - GoodBye | Not | Yes (But Using Enum) | | 4 | ISG iPhone 11 - One | Yes | Yes | | 5 | iPad - Next | Not | Not | | 6 | iPad - One | Yes | Yes | | 7 | iPad - GoodBye | Not | Yes | | 8 | iPad - Yes | Not | Yes | | 9 | Simulator - iPhone 15 - Next, Yes, One, GoodBye | Yes | Yes | Please help me in it...
Posted
by Infosense.
Last updated
.
Post not yet marked as solved
5 Replies
457 Views
I have several AppEnum in my app and I can no longer succesfully get a value using requestValue / requestDisambiguation methods in when running an AppIntent. They all stopped working in iOS 17.4; The list of cases does show to the user but uppon selection it throws the following error: AppIntents.PerformIntentError.unsupportedValueType
Posted Last updated
.
Post marked as solved
1 Replies
97 Views
I'm currently exploring how to implement the AppIntent parameter with a list of apps similar to what's shown in the screenshots provided below: I'm particularly interested in how the searchable list of apps is implemented. My current approach involves creating an enum for the apps, but it lacks searchability and requires manual addition of each app. Does anyone have an idea on how this functionality might be implemented? It appears that the searchable list might be a native Apple view, but I haven't been able to find any documentation or resources on it. Any insights or pointers would be greatly appreciated!
Posted Last updated
.
Post not yet marked as solved
1 Replies
88 Views
Creating AppEntity objects for use as AppIntents to do filtering no longer works in iOS 17.4. If you have a prior shortcut setup that does that, then it will work. It seems some apps still work, but mostly i see the app shortcut action no longer has the Filtering options.
Posted Last updated
.
Post not yet marked as solved
2 Replies
251 Views
Hi! I have an AppShortcutsProvider that has been marked @available(iOS 17.0, *), because all Intents used within it are only available in iOS 17. So the static var appShortcuts should only be accessible in iOS 17, obviously. Now this code has been released and works fine for iOS 17 users. But I just noticed that around 150 iOS 16 users have crashed in the static var appShortcuts, or more specifically, the defaultQuery of one of the Intents. This should not be possible, as neither the AppShortcutsProvider, nor the Intent is exposed to iOS 16, they are marked as @available(iOS 17.0, *). Any idea why this could happen? Here is the crash log: Crashed: com.apple.root.user-initiated-qos.cooperative 0 libswiftCore.dylib 0x3e178c swift::ResolveAsSymbolicReference::operator()(swift::Demangle::__runtime::SymbolicReferenceKind, swift::Demangle::__runtime::Directness, int, void const*) 1 libswiftCore.dylib 0x40bec4 swift::Demangle::__runtime::Demangler::demangleSymbolicReference(unsigned char) 2 libswiftCore.dylib 0x408254 swift::Demangle::__runtime::Demangler::demangleType(__swift::__runtime::llvm::StringRef, std::__1::function<swift::Demangle::__runtime::Node* (swift::Demangle::__runtime::SymbolicReferenceKind, swift::Demangle::__runtime::Directness, int, void const*)>) 3 libswiftCore.dylib 0x3e9680 swift_getTypeByMangledNameImpl(swift::MetadataRequest, __swift::__runtime::llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) 4 libswiftCore.dylib 0x3e4d9c swift_getTypeByMangledName 5 libswiftCore.dylib 0x3e50ac swift_getTypeByMangledNameInContext 6 MyApp 0x3f6b8c __swift_instantiateConcreteTypeFromMangledName (<compiler-generated>) 7 MyApp 0x640e3c one-time initialization function for defaultQuery + 146 (IntentAction.swift:146) 8 libdispatch.dylib 0x3eac _dispatch_client_callout 9 libdispatch.dylib 0x56ec _dispatch_once_callout 10 MyApp 0x64109c protocol witness for static AppEntity.defaultQuery.getter in conformance IntentAction + 124 (IntentAction.swift:124) 11 AppIntents 0x15c760 _swift_stdlib_malloc_size 12 AppIntents 0x19dfd4 __swift_destroy_boxed_opaque_existential_1Tm 13 MyApp 0x52dadc specialized ActionIntent.init(action:) + 41 (ActionIntent.swift:41) 14 MyApp 0x52df80 specialized static MyShortcuts.appShortcuts.getter + 17 (MyShortcuts.swift:17)
Posted Last updated
.
Post not yet marked as solved
0 Replies
119 Views
Hello, I am developing a Chat application, and I was able to successfully implement INSendMessageIntent to be able to have suggestions in Share Extensions with some of my contacts. I've noticed that after a day or two, avatars are lost, and 2 tested devices are displaying empty background. When I use my app to send a message, this new chat appears with avatar properly, but just after some time it goes away. I am using: let avatarImage = INImage(url: avatarUrl) intent.setImage(avatarImage, forParameterNamed: \.speakableGroupName) where avatarUrl can be a file created in NSTemporaryDirectory or just a file in my shared AppGroup directory. As you can see, Telegram suggestions work fine, suggestions from my app works well as well when I donate the intent, but after some time avatars just goes away Does apple perform some avatar caching, so when I donate the intent avatars are stored for Share sheet somewhere? Or they always use my local url and I need to make sure it's not deleted?
Posted Last updated
.
Post not yet marked as solved
0 Replies
192 Views
Hello, We're interested in using the PTT Framework with our PTT capable hardware, as the framework has intended. The problem is activating Siri with any of our specified Intent's doesn't work when the phone is locked. The iPhone always says "You'll have to unlock your iPhone first". Reading up on the problem, it seems pretty common in the fact that Apple doesn't allow Siri Intents to be executed while the phone is locked. It's a sensible precaution by default, but there are countless threads of real use cases that users want to use Siri without unlocking (with PTT, or well, without). There appears to be no options for PTT to enable this, any flags on the Siri Intent to allow benign App actions or queries, user UI configuration through Settings -> Siri & Search to manually allow it even when the phone is locked. Neither are there any entitlements (that I'm aware of) that would allow trivial and non-secure Siri App Intents. The only advice we have for our users (and albeit against the intention of the limitation in the first place) is to: Disable Auto Lock, Disable Face ID and to Disable Passcode. It is in fact 2024, and users do expect a better experience than this with Siri, or am I missing something?
Posted Last updated
.
Post not yet marked as solved
2 Replies
295 Views
Hello! I've noticed that adding localizations for AppShortcuts triggers the following warnings in Xcode 15.3: warning: missing the definition of zh-Hans # variables.1.definitions warning: missing the definition of zh-Hans # variables.2.definitions This occurs with both legacy strings files and String Catalogs. Example project: https://github.com/gongzhang/AppShortcutsLocalizationWarningExample
Posted
by Gong.
Last updated
.
Post not yet marked as solved
0 Replies
170 Views
hello I'm almost finished creating the app but I'm just missing one feature. This is that when the user installs the installation when he opens application A it immediately redirects him to application B which will be mine on a specific page. Can you tell me how I can do this? There is an application that does exactly the same thing, it's 'one sec' my application is identical
Posted Last updated
.
Post not yet marked as solved
1 Replies
195 Views
If an app contains app intents and built using the visionOS 1.1 SDK, and the app is either run on the visionOS 1.0 simulator or a visionOS 1.0 device the app instantly crashes on launch with a missing symbol error. This doesn’t happen with apps built using the visionOS 1.0 SDK. Below is a screenshot of a crash report sent by TestFlight review: Feedback ID: FB13666685
Posted
by rmahmud28.
Last updated
.
Post not yet marked as solved
2 Replies
1.2k Views
Prior to iOS 16, Intent Handlers in SiriKit only had 10 seconds to complete the request. However, i have not come across any mention of a time limit in the documentation for the new AppIntents framework. My own testing revealed this limit to be somewhere between 20-25 seconds. Does anyone know what the official time limit is to complete a request with the new AppIntents framework?
Posted
by nokey4.
Last updated
.
Post not yet marked as solved
0 Replies
214 Views
So I'm working on a logging app that uses Siri to log diaper changes for babies. There are 3 types of diaper changes, wet, dirty, both. I created a enum for these values in the intent definition file and made it configurable and resolvable. in the resolve function, I added this line of code public func resolveDiaperType(for intent: DiaperIntentIntent, with completion: @escaping (DiaperTypeResolutionResult) -> Void) { let needsValue = intent.diaperType == .unknown if needsValue { completion(.needsValue()) } else { completion(.success(with: intent.diaperType)) } } But as soon as .needsValue() is called, the UI will ask user to select one value, and then crash the app. I tried removing a lot of different params and code blocks, needsValue is the only thing that's crashing for me. If I make the default diaperType parameter as .dirty instead of .unknown, it works. Basically it won't let me work with an empty enum parameter. I get the SIGABRT error and the app crashes. I have like 4 intents. 3 of them uses enums. All 3 crash on the enum input UI. all 3 work correctly when the enum is given a value instead of .unknown. The problem is, I NEED to ask user the type. If I give it a default value and resolve it with .needsValue(), it still crashes. I cannot ask the user for a value. I haver made siri intents with enums input before. And those intents STILL WORK. They were just made for older Xcode versions Is this an Xcode bug? Testing on iOS 17.2 simulator Xcode 15.2
Posted Last updated
.
Post not yet marked as solved
0 Replies
268 Views
I have an Intents definition file for a Custom Intent that I want to convert to an AppIntent. The Custom Intent has the checkbox "Configurable in Shortcuts" not checked and therefore the "Convert to App Intent" Button is greyed out. I can however still do a conversion using the Menu-Item "Editor"->"Convert to App Intent". The intent has a number of parameters that are not configurable, but were set in code. This way it was possible to donate shortcuts with the parameters (and even the title) set in code. The automatic conversion using the menu item however produces a result that does not match the legacy Custom Intent (Parameters appear in the Shortcuts App etc). I also did not find any way to create AppIntents that have parameters that can be set in code, before the intent is donated. I would leave the old legacy Custom Intents as they are, but as soon as make use of any of the new iOS 16 Shortcut features (App Shortcuts) the existing donated Custom Intents disappear in the Shortcuts App. Given the apparent inability to convert them into AppIntents due to the missing code-set parameters, I would be happy for any advice on potential solutions.
Posted
by hhtouch.
Last updated
.
Post not yet marked as solved
2 Replies
240 Views
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 = "TWAppIntent" static var parameterSummary: some ParameterSummary { Summary("Get information on \(\.$TWType)") } // we can have multiple parameter of diff types @Parameter(title: "TWType") var TWType: String func perform() async throws -> some IntentResult { return .result(dialog: "Executed TWAppIntent.") } } 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: From what I understand, I m getting this error because I have not added my 'TWAppIntent' to the TWAppIntentExtension.swift file which is the entry point for the extension, but I could not find any documentation around how to add it. Can someone help on how to do it or Is there something else that I m doing wrong?
Posted Last updated
.
Post not yet marked as solved
0 Replies
220 Views
Hello. My project includes a widget target that provides interactive widget functionalities. The document "Adding Interactivity to Widgets and Live Activities" says the following: Additionally, note that the perform() function is marked as throws. Be sure to handle errors instead of rethrowing them, and update your app, widget, and Live Activity as needed. For example, update a widget’s interface to indicate that it displays outdated information if it cannot load new data. https://developer.apple.com/documentation/widgetkit/adding-interactivity-to-widgets-and-live-activities#Implement-the-perform-function, column 3 However, I couldn't find a way how to handle an error in an interactive widget. The Button(intent:) and Toggle(intent:) initializers don't have mechanisms for error handling. Does anyone know a solution for handling errors in interactive widgets?
Posted
by syatyo.
Last updated
.
Post not yet marked as solved
0 Replies
224 Views
Adding the AppIntent of my app as AppShortcuts to the Shortcuts Apps was easy. This only required an AppShortcutsProvider. However, I am confused how the AppShortcuts are shown in the Shortcuts App. It seems that there are different styles enter image The AppShortcuts of some apps are shown as tiles While shortcuts from other apps are shown as collection of circle icons Some "circle collection" use a default gray background with blue icons Others color or even gradient backgrounds with white icons The only thing I found that might be related to the design is the shortcutTileColor property in the AppShortcutsProvider. However using/changing this property has no effect on how my app's shortcus are shown: On the default gray background / blue icon. Among the different apps on my devices I cannot see any logic which shortcuts are shown as tiles and which as circle icons. Additionally third party apps use colored background or gradients. So there there has to be a way to change this. But how?
Posted
by Agenor.
Last updated
.
Post not yet marked as solved
0 Replies
225 Views
AppIntens can be used as actions when working with Shortcut Automation. iOS offers a bunch of different triggers to start an automation, such as "Time of Day", "Email", "Transaction", etc. Depending on the trigger one can then pass different "Shortcut input" values as parameters to the App Intent. While in many cases the expected type is quite obvious, this is not always the case. An Email type input for example offers Subject, Sender, Recipients, Attachments, Content, Name. Subject will be most likely a String. But is Sender also a String or maybe an IntentPerson? Is Recipients a String (e.g. comma separated) or a collection? Is Attachments a [String], [URL] or [IntentFile]? How to I find out of which types these inputs have? Is there a better way than guessing and trial and error? The documentation provides very little information about supported types in general and I could find nothing about the types used by different triggers. Additionally each "Shortcut input" offers it self as parameter. So the Email type input does not only offer Subject, Sender, etc. as input parameters but also Email. What parameter type does an intent need no accept in order to receive on Email object? Thank you very much for your help.
Posted
by Agenor.
Last updated
.
Post not yet marked as solved
0 Replies
279 Views
The Shortcuts app offers the possibility to trigger shortcuts/intends when a wallet credit card is used and a new transaction is created. I would like to add transaction details to one of my apps and use such a shortcut for it. Other apps do the exact same thing, so this should not be a problem. Adding a shortcut to my app was not a big deal. However, how can this be tested on simulator? When trying to add a new automatization in the Shortcuts app using a wallet transaction as trigger I cannot finish the setup dialog since the Next button is disabled. I assume this is because no card is configured. When trying to add a card in Wallet I just receive that this was not successful. I have connected the simulator to a Sandbox Apple ID account using a region which supports Apple Pay (US). Using a real account does not solve the problem. Any idea how to get this working? Using real transaction within a store could obviously not be the solution for debugging.
Posted
by Agenor.
Last updated
.