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

Posts under Intents tag

66 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

iOS18, interactive widget not respond (AppIntent not working)
here is my case: i add the AppIntent to both your app and widget extension targets. the intent will run my app process when app is running. it works perfectly on iOS 17. but iOS 18, my app process never called. i download app's demo, https://developer.apple.com/documentation/widgetkit/emoji-rangers-supporting-live-activities-interactivity-and-animations it looks like the same issue. it runs well because even it runs in the widget extension target, it still can present expected UI. but in real case, we need to run the app process to do some work. by debugging, i found the app process never called(set breakpoint). i add openAppWhenRun, it works well on iOS 18. but it will open the app when the widget is running. it is not what i want.
0
0
57
1d
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)" } }
1
1
238
2d
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
191
2w
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
177
3w
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
179
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
211
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
228
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
251
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
246
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
223
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
276
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
345
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
285
Apr ’24