Implement App Shortcuts with App Intents

RSS for tag

Discuss the WWDC22 Session Implement App Shortcuts with App Intents

Posts under wwdc2022-10170 tag

34 Posts

Post

Replies

Boosts

Views

Activity

App Intents not recognized by Siri, after already being recognized. No code changes.
I setup multiple intents/shortcuts as shown below. I have renamed the shortcuts and omitted the intent code for privacy/security reasons. The code hasn't changed for a few days, and it stopped working. Siri no longer recognizes voiced commands provided in the phrases, when it used to recognize all of them. I have tried deleting the app, disabling Siri/deleting the dictionary, and restarting my phone, but no luck. Nothing can get it working again. Any suggestions or workarounds? I could only find posts where it never worked for some people. I had it working, but it broke. Thanks in advance. import Foundation import AppIntents @available(iOS 16.0, *) struct MyAppShortcuts: AppShortcutsProvider {     static var appShortcuts: [AppShortcut] {         AppShortcut(             intent: ExportAllTransactionsIntent(),             phrases: ["Make a (.applicationName) record", "Make a (.applicationName) *******"])         AppShortcut(             intent: ExportAllTransactionsIntent1(),             phrases: ["Display (.applicationName) ******** codes", "Show (.applicationName)******* *****])         AppShortcut(             intent: ExportAllTransactionsIntent2(),             phrases: ["Display (.applicationName) ********", "Show (.applicationName) *******"])     } }
2
0
2.5k
Oct ’22
SiriTipView showing ${APPLICATIONNAME} instead of my app's name.
Version 14.0 beta 4 (14A5284g) This is all referring to the simulator. When I run the Shortcuts app my phrase is properly shown for my app and the app's name is correctly populated. However, when I try to add a SiriTipView the same phrase shows the application name as ${APPLICATIONNAME}. I changed the first letter of the phrase and verified the change showed up in the Shortcuts app and my app tip. I'm not sure if I'm doing something wrong or should file feedback instead.
3
1
2.1k
Sep ’22
Implemented AppIntent doesn't show in Shortcuts app
I'm trying to test out the new AppIntents API that is currently on iOS16 Beta. Looking at the documentation, the implementation seems pretty straight forward, but after implementing it, I'm not seeing my AppIntent in the Shortcuts app. The device is running iOS 16.0. This is how I implemented the AppIntent: import AppIntents struct DoSomethingIntent: AppIntent { static var title: LocalizedStringResource = "This will do something" static var description = IntentDescription("Does something") func perform() async throws -> some PerformResult { return .finished(value: "Done") } } According to the documentation the Shortcuts app should be able to find my AppIntent after my app gets installed, but I see that's not the case. Does anybody know what my implementation is missing or have I misunderstood the whole thing?
3
2
4.2k
Sep ’22
AppIntents do not work with Shortcuts from lockscreen
I have created an Intent with openAppWhenRun = true, defined a String? parameter and tried to get a value for it through $myParameter.requestDisambiguation in perform method Then I created Shortcut for my Intent When I call my Shortcut from lockscreen this happens: iPhone asks to unlock I unlock it Application opens Nothing happens In debugger I can see that $myParameter.requestDisambiguation executes but nothing happens then. It seems that my application is awaiting $myParameter.requestDisambiguation forever When running shortcut with iPhone being already unlocked, everything works fine. Application opens and I can see disambiguation dialog. If I remove $myParameter.requestDisambiguation call, everything works fine as well What am I doing wrong? Or maybe it is a bug and there is any workaround? My code snippet: struct SampleIntent: AppIntent {  static var openAppWhenRun: Bool = true  static let title: LocalizedStringResource = "Start sample intent"  @Parameter(title: "Test", description: "Test")  var test: String?  func perform() async throws -> some IntentResult {   let choice = try? await $test.requestDisambiguation(among: ["One", "Two", "Three"])   print("Perform method called")   return .result(dialog: "Done")  } } struct SampleShortcuts: AppShortcutsProvider {  static var appShortcuts: [AppShortcut] = [   AppShortcut(    intent: SampleIntent(),    phrases: [     "Hello \(.applicationName)"    ]   )  ] }
1
2
1.9k
Sep ’22
App Intents not appear in Shortcuts App
App shortcuts can only be added to Shortcut Action List, but not a separate App Shortcuts appears at the bottom of the Shortcuts app. Now it only has the default Voice Memo App. It successfully appeared in beta 2/3, but I'm not sure if it appeared in (beta 3 update). But in beta 4, it disappeared. I have no idea how to make it visible again!!!
3
1
3.4k
Sep ’22
AppIntent with Input from share sheet or previous step?
I have the following parameter:     @Parameter(title: "Image", description: "Image to copy", supportedTypeIdentifiers: ["com.image"], inputConnectionBehavior: .connectToPreviousIntentResult)     var imageFile: IntentFile? When I drop my AppIntent into a shortcut, though, I am unable to connect this parameter to the output of the previous step. Given the documentation I have no idea how to achieve this, if the above, is not the correct way to do so.
2
0
1.9k
Aug ’22
Restrict existing siri intents based shortcuts for iOS16
Hello, we are trying to implement our app shortcuts using the new App Intents framework. But the problem is existing siri intents based shortcuts also available in shortcuts app which results in duplication of shortucuts. Is there any way to restrict siri intents based shortcuts for iOS16 and only show app intents based shortcuts in Shortcuts app. We were unable to add any kind of target checks in intent definition file or info plist. Please provide any suggestions.
3
2
1.7k
Aug ’22
AppIntents: pauses in siri's speech and hiding dialog text
Is it possible to put a pause in Siri's responses to an AppIntent? in the code below id like Siri to pause a bit longer than she does between sentence one and sentence two. i've tried using "..." and multiple "." similar to what she does when she's responding to "how is the market" if you ask a HomePod - she pauses a bit longer between her comments on each market, a bit more than an end of sentence - more like the pause between each point when you are going through a list of bullet points - which is really what i'm using this for. Also is it possible to hide all or part of of the dialog text displayed? so she says it but doesn't show it. I've got a view which shows a better formatted representation of what she says than the text itself. struct TestAppIntent: AppIntent {     static var title: LocalizedStringResource = "A question?"     static var openAppWhenRun: Bool = false     @MainActor     func perform() async throws -> some IntentResult {         return .result(             dialog: "sentence one. sentence two", view: someView()         )     } }
1
2
1.4k
Jul ’22
App shortcuts are not getting added inside Shortcuts App using App Intent.
Hi, We are trying to add our application shortcuts using below code but it's not getting reflected in Shortcuts App and so Siri feature is not working for our app. We followed the same approach mentioned in WWDC 2022 session. Kindly suggest the fix. struct StartMeditationIntent: AppIntent {     static let title: LocalizedStringResource = "Start Meditation Session"     func perform() async throws -> some IntentPerformResult {         let answer: LocalizedStringResource = "Session Started"         let dialogIntent  = IntentDialog(answer)         return .finished(dialog: dialogIntent)     } } struct LibraryAutoShortCuts: AppShortcutsProvider {     static var appShortcuts: [AppShortcut] {         AppShortcut(intent: StartMeditationIntent(), phrases: ["Start Meditation"])     } }
2
0
1.6k
Jun ’22
Potential Error in Code Sample in Session Video
In the video the app entity type is called MeditationSession (10:09) but in the StartMeditationIntent the @Parameter's type is SessionType (11:16). Maybe it is a different type but from what I understand it should be the same since the disambiguation is done among SessionManager.allSessions which returns an array of MeditationSessions and the type of sessionToRun needs to match self.session.
0
1
1.4k
Jun ’22
AppIntents not working in xcode 14
Getting an error when import AppIntents framework to project. Command ExtractAppIntentsMetadata failed with a nonzero exit code
Replies
7
Boosts
5
Views
3.2k
Activity
Oct ’22
App Intents not recognized by Siri, after already being recognized. No code changes.
I setup multiple intents/shortcuts as shown below. I have renamed the shortcuts and omitted the intent code for privacy/security reasons. The code hasn't changed for a few days, and it stopped working. Siri no longer recognizes voiced commands provided in the phrases, when it used to recognize all of them. I have tried deleting the app, disabling Siri/deleting the dictionary, and restarting my phone, but no luck. Nothing can get it working again. Any suggestions or workarounds? I could only find posts where it never worked for some people. I had it working, but it broke. Thanks in advance. import Foundation import AppIntents @available(iOS 16.0, *) struct MyAppShortcuts: AppShortcutsProvider {     static var appShortcuts: [AppShortcut] {         AppShortcut(             intent: ExportAllTransactionsIntent(),             phrases: ["Make a (.applicationName) record", "Make a (.applicationName) *******"])         AppShortcut(             intent: ExportAllTransactionsIntent1(),             phrases: ["Display (.applicationName) ******** codes", "Show (.applicationName)******* *****])         AppShortcut(             intent: ExportAllTransactionsIntent2(),             phrases: ["Display (.applicationName) ********", "Show (.applicationName) *******"])     } }
Replies
2
Boosts
0
Views
2.5k
Activity
Oct ’22
SiriTipView showing ${APPLICATIONNAME} instead of my app's name.
Version 14.0 beta 4 (14A5284g) This is all referring to the simulator. When I run the Shortcuts app my phrase is properly shown for my app and the app's name is correctly populated. However, when I try to add a SiriTipView the same phrase shows the application name as ${APPLICATIONNAME}. I changed the first letter of the phrase and verified the change showed up in the Shortcuts app and my app tip. I'm not sure if I'm doing something wrong or should file feedback instead.
Replies
3
Boosts
1
Views
2.1k
Activity
Sep ’22
Implemented AppIntent doesn't show in Shortcuts app
I'm trying to test out the new AppIntents API that is currently on iOS16 Beta. Looking at the documentation, the implementation seems pretty straight forward, but after implementing it, I'm not seeing my AppIntent in the Shortcuts app. The device is running iOS 16.0. This is how I implemented the AppIntent: import AppIntents struct DoSomethingIntent: AppIntent { static var title: LocalizedStringResource = "This will do something" static var description = IntentDescription("Does something") func perform() async throws -> some PerformResult { return .finished(value: "Done") } } According to the documentation the Shortcuts app should be able to find my AppIntent after my app gets installed, but I see that's not the case. Does anybody know what my implementation is missing or have I misunderstood the whole thing?
Replies
3
Boosts
2
Views
4.2k
Activity
Sep ’22
AppIntents do not work with Shortcuts from lockscreen
I have created an Intent with openAppWhenRun = true, defined a String? parameter and tried to get a value for it through $myParameter.requestDisambiguation in perform method Then I created Shortcut for my Intent When I call my Shortcut from lockscreen this happens: iPhone asks to unlock I unlock it Application opens Nothing happens In debugger I can see that $myParameter.requestDisambiguation executes but nothing happens then. It seems that my application is awaiting $myParameter.requestDisambiguation forever When running shortcut with iPhone being already unlocked, everything works fine. Application opens and I can see disambiguation dialog. If I remove $myParameter.requestDisambiguation call, everything works fine as well What am I doing wrong? Or maybe it is a bug and there is any workaround? My code snippet: struct SampleIntent: AppIntent {  static var openAppWhenRun: Bool = true  static let title: LocalizedStringResource = "Start sample intent"  @Parameter(title: "Test", description: "Test")  var test: String?  func perform() async throws -> some IntentResult {   let choice = try? await $test.requestDisambiguation(among: ["One", "Two", "Three"])   print("Perform method called")   return .result(dialog: "Done")  } } struct SampleShortcuts: AppShortcutsProvider {  static var appShortcuts: [AppShortcut] = [   AppShortcut(    intent: SampleIntent(),    phrases: [     "Hello \(.applicationName)"    ]   )  ] }
Replies
1
Boosts
2
Views
1.9k
Activity
Sep ’22
App Intents not appear in Shortcuts App
App shortcuts can only be added to Shortcut Action List, but not a separate App Shortcuts appears at the bottom of the Shortcuts app. Now it only has the default Voice Memo App. It successfully appeared in beta 2/3, but I'm not sure if it appeared in (beta 3 update). But in beta 4, it disappeared. I have no idea how to make it visible again!!!
Replies
3
Boosts
1
Views
3.4k
Activity
Sep ’22
Sample Code for App Intents?
Will any of the sample code from the App Intents session be provided?
Replies
1
Boosts
2
Views
1.5k
Activity
Aug ’22
AppIntent with Input from share sheet or previous step?
I have the following parameter:     @Parameter(title: "Image", description: "Image to copy", supportedTypeIdentifiers: ["com.image"], inputConnectionBehavior: .connectToPreviousIntentResult)     var imageFile: IntentFile? When I drop my AppIntent into a shortcut, though, I am unable to connect this parameter to the output of the previous step. Given the documentation I have no idea how to achieve this, if the above, is not the correct way to do so.
Replies
2
Boosts
0
Views
1.9k
Activity
Aug ’22
Restrict existing siri intents based shortcuts for iOS16
Hello, we are trying to implement our app shortcuts using the new App Intents framework. But the problem is existing siri intents based shortcuts also available in shortcuts app which results in duplication of shortucuts. Is there any way to restrict siri intents based shortcuts for iOS16 and only show app intents based shortcuts in Shortcuts app. We were unable to add any kind of target checks in intent definition file or info plist. Please provide any suggestions.
Replies
3
Boosts
2
Views
1.7k
Activity
Aug ’22
Working From Home Shortcut
Hello, I am creating a shortcut to ask me at a specific time on certain days, am I working from home tomorrow. If I answer with yes, turn on my 8AM alarm, otherwise, if no, turn on my 7AM alarm. I am almost there with choosing a list and if then function but cannot seem to figure out why the rest will not work. Thoughts?
Replies
0
Boosts
0
Views
650
Activity
Jul ’22
AppIntents: pauses in siri's speech and hiding dialog text
Is it possible to put a pause in Siri's responses to an AppIntent? in the code below id like Siri to pause a bit longer than she does between sentence one and sentence two. i've tried using "..." and multiple "." similar to what she does when she's responding to "how is the market" if you ask a HomePod - she pauses a bit longer between her comments on each market, a bit more than an end of sentence - more like the pause between each point when you are going through a list of bullet points - which is really what i'm using this for. Also is it possible to hide all or part of of the dialog text displayed? so she says it but doesn't show it. I've got a view which shows a better formatted representation of what she says than the text itself. struct TestAppIntent: AppIntent {     static var title: LocalizedStringResource = "A question?"     static var openAppWhenRun: Bool = false     @MainActor     func perform() async throws -> some IntentResult {         return .result(             dialog: "sentence one. sentence two", view: someView()         )     } }
Replies
1
Boosts
2
Views
1.4k
Activity
Jul ’22
App shortcuts are not getting added inside Shortcuts App using App Intent.
Hi, We are trying to add our application shortcuts using below code but it's not getting reflected in Shortcuts App and so Siri feature is not working for our app. We followed the same approach mentioned in WWDC 2022 session. Kindly suggest the fix. struct StartMeditationIntent: AppIntent {     static let title: LocalizedStringResource = "Start Meditation Session"     func perform() async throws -> some IntentPerformResult {         let answer: LocalizedStringResource = "Session Started"         let dialogIntent  = IntentDialog(answer)         return .finished(dialog: dialogIntent)     } } struct LibraryAutoShortCuts: AppShortcutsProvider {     static var appShortcuts: [AppShortcut] {         AppShortcut(intent: StartMeditationIntent(), phrases: ["Start Meditation"])     } }
Replies
2
Boosts
0
Views
1.6k
Activity
Jun ’22
Shows duplicate shortcuts in Shortcuts app
Hello, If application has Siri Shortcuts which are configurable inside Shortcuts app and if make app intents for that Siri Shortcuts, it shows duplicate entries while searching for application and available shortcuts. Any way to avoid this? Thanks Hiren
Replies
0
Boosts
0
Views
806
Activity
Jun ’22
Potential Error in Code Sample in Session Video
In the video the app entity type is called MeditationSession (10:09) but in the StartMeditationIntent the @Parameter's type is SessionType (11:16). Maybe it is a different type but from what I understand it should be the same since the disambiguation is done among SessionManager.allSessions which returns an array of MeditationSessions and the type of sessionToRun needs to match self.session.
Replies
0
Boosts
1
Views
1.4k
Activity
Jun ’22