Share intents from within an app to drive system intelligence and show the app's actions in the Shortcuts app.

Posts under Intents tag

63 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Type '' does not conform to protocol '_IntentValue' - AppIntents
Hi there. First time poster! I'm attempting to implement App Intents in my app, as part of the App Intent I have included a parameter requiring the user specify one of their 'to do lists'. @Parameter(title: "List", description: "One of your Marvelist lists.") var list: MarvelistModels.List However, I'm receiving the below error in Xcode... Type 'MarvelistModels.List' does not conform to protocol '_IntentValue' When I go to the struct for MarvelistModels.List, and attempt to make it conform to _IntentValue, it adds typealias Specification = type to my struct... however, I can't quite figure out how to make it conform. Any help/advice would be greatly appreicated!
0
1
178
1w
Handling App Intents Behind Authentication/Paywall
My App has several resources that I'd like to spring open through App Intents. For example a series of Dictionaries. These resources however in the app are behind a log in (for security) and are entitlements that are purchased. They may own 4 of 7 dictionaries. If I want to have an intent that says, "Open Dictionary: (Dict Name)" how do I best handle situations where the user may no longer be logged in or have the entitlement for that specific dictionary? Thanks
1
0
166
2w
Unexpected URLRepresentableIntent behaviour
After watching the What's new in App Intents session I'm attempting to create an intent conforming to URLRepresentableIntent. The video states that so long as my AppEntity conforms to URLRepresentableEntity I should not have to provide a perform method . My application will be launched automatically and passed the appropriate URL. This seems to work in that my application is launched and is passed a URL, but the URL is in the form: FeatureEntity/{id}. Am I missing something, or is there a trick that enables it to pass along the URL specified in the AppEntity itself? struct MyExampleIntent: OpenIntent, URLRepresentableIntent { static let title: LocalizedStringResource = "Open Feature" static var parameterSummary: some ParameterSummary { Summary("Open \(\.$target)") } @Parameter(title: "My feature", description: "The feature to open.") var target: FeatureEntity } struct FeatureEntity: AppEntity { // ... } extension FeatureEntity: URLRepresentableEntity { static var urlRepresentation: URLRepresentation { "https://myurl.com/\(.id)" } }
0
0
222
2w
Migrating custom intents to App Intents
Hi, I am trying to migrate my custom intents to App Intents, and was running into some issues. My current intentdefinitions file and all intent handling code are in a framework that is shared with my app target. I went through the migration assistant and added the App Intents codes directly to my main app target. When I run a shortcut with the App Intent, it doesn't work ... I get some messages in the console that say: Could not find an intent with identifier MyCustomAddContactIntent, mangledTypeName: Optional("") I guess the old custom intents and new App Intents should both live in the same package to see each other. In this case, I'm not sure if all the existing custom intents file and all the intents handler logic should be moved into the main app bundle (and removed from framework), or should I add the new App Intents handlers into the framework (in addition to the main app)? Also, will the custom framework even be needed or run in iOS16+? Thanks.
0
0
173
3w
Are suggested Play Media Intents no longer shown on lock screen?
Play media intents suggested via INUpcomingMediaManager.setSuggestedMediaIntents(_:) have been shown on the iOS lock screen in past iOS versions. In iOS 16/17 play media intents seem to be only shown within the Siri suggestions in the spotlight overlay and in the Siri suggestion widget. When the intents were shown on the lock screen, it was possible to open a preview via long press. Similar to notification previews. Preview support could be implemented with an Intents UI extension. Is there still any place in current iOS versions where play media intents are surfaced and a preview can be opened? In the spotlight overlay a long press has no effect.
0
0
206
May ’24
Can we add an action to the 'Shortcuts' app in macOS using 'Intents extension'?
I have macOS application and I want to provide an action for it in the 'Shortcuts' app QuickAction list. I was using InApp handling to present my intent created in the intent.intentdefinition file as action in the shortcuts app and it was working. However, this action perform a very lightweight task so I intent to have the action implemented as an extension in my xcode project. According to my minimum deployment(i.e macOS 11.0) I found that 'Intents Extension' could be used. I have added the 'Intents extension' target to my main application and created an intent using the intent.intentdefinition file. However, my intent does not appear in the shortcuts app. I have verified it multiple time to ensure I am not missing anything, but still the intent is not present in the shortcuts app action. I wanted to be know, Is this even possible? cause this apple documentation only mentions about iOS and watchOS app. It also does not mention If our custom intent(created using Intents extension) in the intents extension can be exposed to the shortcuts app. For macOS 13.0+, I have used the 'AppIntents extension' and I m able to achieve the same. So, I suppose the same should be possible using the 'Intents extension'
1
0
221
May ’24
'openAppWhenRun' property causing AppIntentsExtension to fail
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?
0
1
245
May ’24
Calling AppIntent Siri Voice Issue
Hello, I have an app with two AppIntents. I invoke first AppIntent with my voice command, then I would like invoke the second AppIntent after the first one. I have implemented the necessary return type for the first AppIntent. My first AppIntent is invoked and executes successfully, however when it calls the second AppIntent, everything inside perform() method in the second AppIntent works but Siri dialog. Siri doesn't say the dialog in the second AppIntent. Below implementation details for my two AppIntents together with AppShortcutsProvider. I appreciate any help. struct MyFirstAppIntent : AppIntent { static let title: LocalizedStringResource = "Show My Usages" func perform() async throws -> some ProvidesDialog & OpensIntent { let dialogStr = IntentDialog(stringLiteral: "You have a package") print("I'm in first AppIntent") return .result(opensIntent: MySecondAppIntent(), dialog: dialogStr) } struct MySecondAppIntent: AppIntent { static let title: LocalizedStringResource = "Show My Usages" func perform() async throws -> some IntentResult & ReturnsValue<String> & ProvidesDialog { print("I'm in second AppIntent") return .result(value: "Listing Packages", dialog: "You have activated Default") } struct MyVoiceShortcutProvider : AppShortcutsProvider { @AppShortcutsBuilder static var appShortcuts: [AppShortcut] { AppShortcut( intent: MyFirstAppIntent(), phrases: ["Call my first intent \(.applicationName)"] ); AppShortcut( intent: MySecondAppIntent(), phrases: ["Call my second intent \(.applicationName)"] ); } }
0
0
235
May ’24
Passing arbitrary strings to AppIntent
I'm using the TrailsSampleApp (in the AppIntentsSampleApp project which is provided by Apple. According to the code, if you use the "Get conditions with TrailsSampleApp" and provide a trail that is NOT in the suggested entities, it should pass control to the following TrailEntityQuery extension. /// An EntityStringQuery extends the capability of an EntityQuery by allowing people to search for an entity with a string. extension TrailEntityQuery: EntityStringQuery { /** To see this method, configure the Get Trail Info intent in the Shortcuts app. A list displays the suggested entities. If you search for an entity not in the suggested entities list, the system passes the search string to this method. - Tag: string_query */ func entities(matching string: String) async throws -> [TrailEntity] { Logger.entityQueryLogging.debug("[TrailEntityQuery] String query for term \(string)") return trailManager.trails { trail in trail.name.localizedCaseInsensitiveContains(string) }.map { TrailEntity(trail: $0) } } } It says if you configure the Get Trail Info section in the Shortcuts App, control will be passed to this entities() function. However, it doesn't say how to configure it. Any suggestions or help?
0
0
218
Apr ’24
suggestedEntities not being called
I'm adding AppIntents to my existing "ShopList" app and I'm having two problems that I think are related. I can't get shortcuts (or Siri) to work when I pass a parameter to an intent. It works if I don't pass a parameter though. My StoreEntityQuery.suggestedEntities function is not being called during initialization. I have an AppIntentsShortcutProvider defined as follows. class ShopListShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut(intent: FindStore(), phrases: [ "Find \(\.$store) store in \(.applicationName)" ], shortTitle: "Find Store", systemImageName: "cart") } } Details below. I would appreciate any suggestions on what I'm missing or doing wrong. In my AppDelegate "didFinishLaunchingWithOptions" function, I call ShopListShortcuts.updateShortcutParameters. The FindStore struct is defined as follows. struct FindStore: AppIntent { static var title: LocalizedStringResource = "Find Store" static var description = IntentDescription("Finds a store.") static var openAppWhenRun: Bool = false @Parameter(title: "Store", description: "The store.") var store: StoreEntity @MainActor func perform() async throws -> some IntentResult { print("performing intent with \(store.id) and \(store.name)") return .result() } } The StoreEntity is defined as follows. struct StoreEntity: AppEntity { ... static var defaultQuery = StoreEntityQuery() var id: Store.ID @Property(title: "Store Name") var name: String ... } And finally the StoreEntityQuery is defined as follows. struct StoreEntityQuery: EntityQuery { func entities(for identifiers: [StoreEntity.ID]) async throws -> [StoreEntity] { print("entities call") return ... } func suggestedEntities(for identifiers: [StoreEntity.ID]) async throws -> [StoreEntity] { print("suggested entities call") return ... } }
1
0
269
Apr ’24
self.extensionContext.intent return nil
when i was develop ShareExtension, and I donate a intent to share suggestion, and it appeared on my share sheet, but I launched the ShareExtension by clicked icon in suggestion list. and i executed the following code in my project, i got nil of intent. and extensionContext is not nil. '''self.extensionContext.intent''' I would greatly appreciate some insight of what could be possible going wrong here. Thanks in advance!
0
0
281
Apr ’24
AppIntent Parameter Argument List of Apps
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!
1
0
370
Apr ’24
ShareExtension suggestions loosing avatars after a while
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?
1
0
338
Apr ’24
Siri intents crashing when resolving with needsValue
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
0
0
409
Mar ’24
Shortcuts doesn't honor Always Allow with custom AppEntity!
My app has an AppIntent that returns a collection of AppEntity items. Using a shortcut with the repeat with each action to loop the entities, it prompts me multiple times to allow to share the entities (I select "Always Allow" on the first one, but it keeps asking over and over). All the prompts after the first one, shows an incorrect note saying something like: "Previously this shortcut was allowed to share 1 item with …" the count of items shared is always wrong, for example, if I initially selected "Always Allow" for 10 entities on the first prompt, the second says previously 1 item, the third prompt actually has the count right, saying 10 items, and then a fourth prompt (seems to be the last one) says something like 40 items Some more facts: This issue does not happen for example when I fetch entities from a system based intent, like get calendar events. It correctly only prompt for my permission once My app is already on the app store
0
0
359
Feb ’24