Dive into App Intents

RSS for tag

Discuss the WWDC22 Session Dive into App Intents

Posts under wwdc2022-10032 tag

37 Posts

Post

Replies

Boosts

Views

Activity

App Intents, put `@Parameter` into `ParameterSummary` or drop-down list
Hello, On the wwdc22 Dive into App Intents video in 16:08 you can see that part of parameters are in ParamaterSummary and one is in the drop-down menu. When I am adding a ParamaterSummary to my AppIntent the drop-down menu is disapearing so part of my parameters is not able to set. I have tried force to display drop-down menu by chosing specific result of perform() method by even that the parameters are not displayed there. How can I split parameters into ParamaterSummary or drop-down list? Best, Marcin
0
0
1.2k
Nov ’22
Beginner develop app with siri control
I'd like to try designing an apple app that has siri control to count up to a set limit via voice control. For example, I could say 'Siri - add 3lb', then a few minutes later, 'Siri-add 6lb'. (which would bring a total to 9lb). Then a bit later say 'Siri- add 2lb' (so would then bring a running total to 11lb) Then add other commands such as 'Siri - what is the total' to then get a total of how much is in the basket and how far I am off the set limit. Or add a warning if a set limit is reached when I add further contents. Or, then add a second basket and start afresh. I just don't know whether this is possible or where to start in the design process as I'm a complete newbie on this kind of thing. What I want to know is where to start. What is the software needed? Is it App-intents, Xcode, Swift etc. Any pointers to where I should start researching first would be appreciated. Thanks, Joe
2
0
1.7k
Oct ’22
Bug in AppIntents / Shortcuts App
I recently spent a decent amount of time trying to troubleshoot why my AppIntents were sometimes failing without any reason and sometimes working. My specific goal is to work with a collection of results that come back from running the intent in Shortcuts. What I noticed, is that due to the fact [Element] seems to become Element , it means that if you attempt to trigger a command that would concat the values, it will cause an error since you have Element [Element, Element] Element etc rather than [Element] [Element, Element] [Element] as expected. As an example, I am trying to use Choose From List on the result from my shortcut. It works beautifully well even for a collection of results as long as none of the results have a single element. As example, the shortcut is returning an entity which also nests entities. This works as expected so-long as my entity results all have more than 1 element. So say I run an action: Get Home Locations - Zones The result is HomeLocationAppEntity where each zone has rooms array. I get back the following: Indoor - Rooms [Living Room, Main Bed, Main Bath, ...] Outdoor - Rooms [Pool, Front Yard] Occupancy Aware - Rooms [Main Bath] In the case above, if I attempt to get the Included Rooms value on the total result above, a fatal error occurs with a message There was a problem running the shortcut. If I change it so if a count is ever 1, I will just add the same entity twice so that none of the results are [Element] so they will be at least 2 rooms wide, then it works (albeit duplicates). struct HomeLocationAppEntity: TransientAppEntity {   static let typeDisplayRepresentation = TypeDisplayRepresentation(name: "Home Location")       var id: String = ""       @Property(title: "Name")   var name: String   @Property(title: "Unique Identifier")   var uniqueIdentifier: String       @Property(title: "Included Rooms (Homes & Zones Only)")   var rooms: [HomeLocationAppEntity]       @Property(title: "Included Zones (Homes Only)")   var zones: [HomeLocationAppEntity]       @Property(title: "Total Rooms (Homes and Zones Only)")   var totalRooms: Int       @Property(title: "Total Zones (Homes Only)")   var totalZones: Int       @Property(title: "Location Type")   var locationType: HomeLocationTypeAppEnum   var displayRepresentation: DisplayRepresentation {     .init(       title: "\(name)",       subtitle: "\(locationType.rawValue.capitalized.replacingSuffix("s", with: ""))\(totalRooms > 0 ? " | \(totalRooms) Rooms" : "")\(totalZones > 0 ? " | \(totalZones) Zones" : "")",       image: .init(         systemName: "house.fill",         tintColor: .init(named: "systemCyan")       )     )   } }
0
0
1.4k
Oct ’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
Shortcuts editor doesn't recognize boolean EntityQueryProperty
My AppEntity has a Bool property, and I would like to query by this property using EntityPropertyQuery. I'm creating an EntityQueryProperty for it with an EqualToComparator as the following (partial code for brevity): // My AppEntity struct AlbumAppEntity: AppEntity, Identifiable { @Property(title: "Hidden") var isHidden: Bool // Other properties } // My EntityPropertyQuery static var properties = QueryProperties { Property(\AlbumAppEntity.$isHidden) { EqualToComparator { isHidden in if isHidden { return NSPredicate(format: "isHidden == YES") } else { return NSCompoundPredicate(type: .or, subpredicates: [NSPredicate(format: "isHidden = nil"), NSPredicate(format: "isHidden == NO")]) } } } } But the problem is that Shortcuts does not recognize it as a boolean parameter in the shortcuts editor. It recognizes it as a numeric field, which returns the error AppIntents.EntityPropertyQueryError error 2 when run: I also tried different NSPredicate, but the result is always the same: Property(\AlbumAppEntity.$isHidden) { EqualToComparator { NSPredicate(format: "isHidden == %d", $0) } } Property(\AlbumAppEntity.$isHidden) { EqualToComparator { NSPredicate(format: "isHidden == %@", NSNumber(value: $0)) } } How can I query using boolean properties in a way that Shortcuts recognizes it and provides appropriate fields in the shortcuts editor?
0
1
1.3k
Aug ’22
How to sort my Core Data entities using the new query properties from AppIntents
TL;DR How to create an NSSortDescriptor using a PartialKeyPath instead of a KeyPath? Or How to convert a PartialKeyPath to a KeyPath? Details I'm using the new query properties from AppIntents to filter my app's data in Shortcuts, but I'm unable to map the sorting attribute it gives me to the sorting attribute Core Data expects in the predicate. Here's my EntityPropertyQuery implementation: extension ArtistQuery: EntityPropertyQuery { static var sortingOptions = SortingOptions { SortableBy(\ArtistEntity.$name) } static var properties = QueryProperties { Property(\ArtistEntity.$name) { EqualToComparator { NSPredicate(format: "name = %@", $0) } ContainsComparator { NSPredicate(format: "name CONTAINS %@", $0) } } } func entities(matching comparators: [NSPredicate], mode: ComparatorMode, sortedBy: [Sort<ArtistEntity>], limit: Int?) async throws -> [ArtistEntity] { Database.shared.findArtists(matching: comparators, matchAll: mode == .and, sorts: sortedBy.map { NSSortDescriptor(keyPath: $0.by, ascending: $0.order == .ascending) }) } } And my findArtists method is implemented as follows: static func findArtists(matching comparators: [NSPredicate], matchAll: Bool, sorts: [NSSortDescriptor]) -> [EArtist] { ... } As we can see in the entities(matching:) function, I'm using the by attribute from the sortedBy parameter to create the NSSortDescriptor, but it doesn't work because the NSSortDescriptor init expects a KeyPath, not a PartialKeyPath: Cannot convert value of type 'PartialKeyPath<ArtistEntity>' to expected argument type 'KeyPath<Root, Value>' So, can I create an NSSortDescriptor using a PartialKeyPath instead of a KeyPath? Or maybe converting a PartialKeyPath to a KeyPath?
1
1
1.7k
Aug ’22
Donating App Intent with parameters (iOS 16 beta)
Has anybody managed to use the new IntentDonationManager to donate an intent which has a number of parameters defined with @Parameter? For example, given this snippet: struct MyIntent: AppIntent { ...     @Parameter(title: "MyParameter")     var parameter: MyParameter ... } When you use the constructor, the arguments are of type IntentParameter<MyParameter> rather than MyParameter. How do you actually create an instance of IntentParameter to pass into the constructor?
1
0
2.3k
Aug ’22
App Intent in separate target doesn't work
Made a separate target for App Intents, but I don't get it to work. The intent is shown in the Shortcuts app when registered using AppShortcutsProvider. But upon running the intent it gives this error: Error Domain=LNActionFor- AutoShortcutPhraseFetchError Code=1 "No AutoShortcuts instance registered." UserInfo={NSLocalizedDescription=No AutoShortcuts instance registered.} I've attached a sample project to my FA-post FB10199299
5
1
2.7k
Aug ’22
[Possible is bug] @Parameter(requestValueDialog:) doesn't shows value in dialog view when user set value: ask every time
I had the next intent: struct Intent: AppIntent { static var title: LocalizedStringResource = "Intent" static var openAppWhenRun: Bool = true @Parameter(title: "Title", requestValueDialog: .init("Dialog")) var entity: [Entities] @MainActor func perform() async throws -> some IntentResult { // return result } } Is it a bug in the AppIntents framework? Because I don't understand why I don't see parameter value when the user set this option
0
0
821
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
iOS 16 App Intents - Is it possible to have different results?
Hi, I am building a series of App Intents with the new SDK, and I keep facing the issue that in some cases I want to return a result with dialog, others without or others can open an intent. Here I get an error because I am not specifying in the signature that OpensIntent, but if I do so, I cannot keep the other result simple. func perform() async throws -> some IntentResult  {         do {             try ShortCutsManager.shared.scrollToNextStep()             return .result()         } catch let error {             if let shortcutError = error as? ShortCutsManagerError, shortcutError == ShortCutsManagerError.noMoreSteps {                 return .result(opensIntet: NewIntent())             }             throw error         }     } I made a work around, but then I cannot return a dialog in the second return, and say "well done" func perform() async throws -> some IntentResult  {         do {             try ShortCutsManager.shared.scrollToNextStep()             return .result()         } catch let error {             if let shortcutError = error as? ShortCutsManagerError, shortcutError == ShortCutsManagerError.noMoreSteps {                 try await requestConfirmation(output: .result(dialog: "Do you want to mark this recipe as cooked?"){                     EmptyView()                 })                 try doSomething()                 return .result("well done!")             }             throw error         }     } is this even possible? Or is it at least consider for a close future? thanks a lot in advance
0
0
1.2k
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()         )     } }
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
Use New AppIntents Framework Not Work to Show Shortcuts
I have set Xcode preference Command line Tools to Xcode14.0, but is not work, so What's wrong with me?Environment configuration or certificate authority ? This is My Code : import Foundation import SwiftUI import AppIntents struct ShowMyProgressIntent: AppIntent { static var title: LocalizedStringResource = "Show Sport Progress" @MainActor func perform() async throws -> some IntentPerformResult { return .finished { ProgressView() } } } struct StartSportActivityIntent: AppIntent { static var title: LocalizedStringResource = "Start Sport Activity" static var openAppWhenRun: Bool = true // Open app directly @Parameter(title: "Activity") var activity: SportActivity @MainActor func perform() async throws -> some IntentPerformResult { let model = SportActivityModel(type: activity) ViewModel.shared.navigateTo(model: model) return .finished(value: true) } } struct SportLogShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: ShowMyProgressIntent(), phrases: [ "Show My Progress in (.applicationName)", "Start running now" ] ) } }
0
0
987
Jun ’22
App Intents, put `@Parameter` into `ParameterSummary` or drop-down list
Hello, On the wwdc22 Dive into App Intents video in 16:08 you can see that part of parameters are in ParamaterSummary and one is in the drop-down menu. When I am adding a ParamaterSummary to my AppIntent the drop-down menu is disapearing so part of my parameters is not able to set. I have tried force to display drop-down menu by chosing specific result of perform() method by even that the parameters are not displayed there. How can I split parameters into ParamaterSummary or drop-down list? Best, Marcin
Replies
0
Boosts
0
Views
1.2k
Activity
Nov ’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
Beginner develop app with siri control
I'd like to try designing an apple app that has siri control to count up to a set limit via voice control. For example, I could say 'Siri - add 3lb', then a few minutes later, 'Siri-add 6lb'. (which would bring a total to 9lb). Then a bit later say 'Siri- add 2lb' (so would then bring a running total to 11lb) Then add other commands such as 'Siri - what is the total' to then get a total of how much is in the basket and how far I am off the set limit. Or add a warning if a set limit is reached when I add further contents. Or, then add a second basket and start afresh. I just don't know whether this is possible or where to start in the design process as I'm a complete newbie on this kind of thing. What I want to know is where to start. What is the software needed? Is it App-intents, Xcode, Swift etc. Any pointers to where I should start researching first would be appreciated. Thanks, Joe
Replies
2
Boosts
0
Views
1.7k
Activity
Oct ’22
Bug in AppIntents / Shortcuts App
I recently spent a decent amount of time trying to troubleshoot why my AppIntents were sometimes failing without any reason and sometimes working. My specific goal is to work with a collection of results that come back from running the intent in Shortcuts. What I noticed, is that due to the fact [Element] seems to become Element , it means that if you attempt to trigger a command that would concat the values, it will cause an error since you have Element [Element, Element] Element etc rather than [Element] [Element, Element] [Element] as expected. As an example, I am trying to use Choose From List on the result from my shortcut. It works beautifully well even for a collection of results as long as none of the results have a single element. As example, the shortcut is returning an entity which also nests entities. This works as expected so-long as my entity results all have more than 1 element. So say I run an action: Get Home Locations - Zones The result is HomeLocationAppEntity where each zone has rooms array. I get back the following: Indoor - Rooms [Living Room, Main Bed, Main Bath, ...] Outdoor - Rooms [Pool, Front Yard] Occupancy Aware - Rooms [Main Bath] In the case above, if I attempt to get the Included Rooms value on the total result above, a fatal error occurs with a message There was a problem running the shortcut. If I change it so if a count is ever 1, I will just add the same entity twice so that none of the results are [Element] so they will be at least 2 rooms wide, then it works (albeit duplicates). struct HomeLocationAppEntity: TransientAppEntity {   static let typeDisplayRepresentation = TypeDisplayRepresentation(name: "Home Location")       var id: String = ""       @Property(title: "Name")   var name: String   @Property(title: "Unique Identifier")   var uniqueIdentifier: String       @Property(title: "Included Rooms (Homes & Zones Only)")   var rooms: [HomeLocationAppEntity]       @Property(title: "Included Zones (Homes Only)")   var zones: [HomeLocationAppEntity]       @Property(title: "Total Rooms (Homes and Zones Only)")   var totalRooms: Int       @Property(title: "Total Zones (Homes Only)")   var totalZones: Int       @Property(title: "Location Type")   var locationType: HomeLocationTypeAppEnum   var displayRepresentation: DisplayRepresentation {     .init(       title: "\(name)",       subtitle: "\(locationType.rawValue.capitalized.replacingSuffix("s", with: ""))\(totalRooms > 0 ? " | \(totalRooms) Rooms" : "")\(totalZones > 0 ? " | \(totalZones) Zones" : "")",       image: .init(         systemName: "house.fill",         tintColor: .init(named: "systemCyan")       )     )   } }
Replies
0
Boosts
0
Views
1.4k
Activity
Oct ’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
Shortcuts editor doesn't recognize boolean EntityQueryProperty
My AppEntity has a Bool property, and I would like to query by this property using EntityPropertyQuery. I'm creating an EntityQueryProperty for it with an EqualToComparator as the following (partial code for brevity): // My AppEntity struct AlbumAppEntity: AppEntity, Identifiable { @Property(title: "Hidden") var isHidden: Bool // Other properties } // My EntityPropertyQuery static var properties = QueryProperties { Property(\AlbumAppEntity.$isHidden) { EqualToComparator { isHidden in if isHidden { return NSPredicate(format: "isHidden == YES") } else { return NSCompoundPredicate(type: .or, subpredicates: [NSPredicate(format: "isHidden = nil"), NSPredicate(format: "isHidden == NO")]) } } } } But the problem is that Shortcuts does not recognize it as a boolean parameter in the shortcuts editor. It recognizes it as a numeric field, which returns the error AppIntents.EntityPropertyQueryError error 2 when run: I also tried different NSPredicate, but the result is always the same: Property(\AlbumAppEntity.$isHidden) { EqualToComparator { NSPredicate(format: "isHidden == %d", $0) } } Property(\AlbumAppEntity.$isHidden) { EqualToComparator { NSPredicate(format: "isHidden == %@", NSNumber(value: $0)) } } How can I query using boolean properties in a way that Shortcuts recognizes it and provides appropriate fields in the shortcuts editor?
Replies
0
Boosts
1
Views
1.3k
Activity
Aug ’22
How to sort my Core Data entities using the new query properties from AppIntents
TL;DR How to create an NSSortDescriptor using a PartialKeyPath instead of a KeyPath? Or How to convert a PartialKeyPath to a KeyPath? Details I'm using the new query properties from AppIntents to filter my app's data in Shortcuts, but I'm unable to map the sorting attribute it gives me to the sorting attribute Core Data expects in the predicate. Here's my EntityPropertyQuery implementation: extension ArtistQuery: EntityPropertyQuery { static var sortingOptions = SortingOptions { SortableBy(\ArtistEntity.$name) } static var properties = QueryProperties { Property(\ArtistEntity.$name) { EqualToComparator { NSPredicate(format: "name = %@", $0) } ContainsComparator { NSPredicate(format: "name CONTAINS %@", $0) } } } func entities(matching comparators: [NSPredicate], mode: ComparatorMode, sortedBy: [Sort<ArtistEntity>], limit: Int?) async throws -> [ArtistEntity] { Database.shared.findArtists(matching: comparators, matchAll: mode == .and, sorts: sortedBy.map { NSSortDescriptor(keyPath: $0.by, ascending: $0.order == .ascending) }) } } And my findArtists method is implemented as follows: static func findArtists(matching comparators: [NSPredicate], matchAll: Bool, sorts: [NSSortDescriptor]) -> [EArtist] { ... } As we can see in the entities(matching:) function, I'm using the by attribute from the sortedBy parameter to create the NSSortDescriptor, but it doesn't work because the NSSortDescriptor init expects a KeyPath, not a PartialKeyPath: Cannot convert value of type 'PartialKeyPath<ArtistEntity>' to expected argument type 'KeyPath<Root, Value>' So, can I create an NSSortDescriptor using a PartialKeyPath instead of a KeyPath? Or maybe converting a PartialKeyPath to a KeyPath?
Replies
1
Boosts
1
Views
1.7k
Activity
Aug ’22
Donating App Intent with parameters (iOS 16 beta)
Has anybody managed to use the new IntentDonationManager to donate an intent which has a number of parameters defined with @Parameter? For example, given this snippet: struct MyIntent: AppIntent { ...     @Parameter(title: "MyParameter")     var parameter: MyParameter ... } When you use the constructor, the arguments are of type IntentParameter<MyParameter> rather than MyParameter. How do you actually create an instance of IntentParameter to pass into the constructor?
Replies
1
Boosts
0
Views
2.3k
Activity
Aug ’22
App Intent in separate target doesn't work
Made a separate target for App Intents, but I don't get it to work. The intent is shown in the Shortcuts app when registered using AppShortcutsProvider. But upon running the intent it gives this error: Error Domain=LNActionFor- AutoShortcutPhraseFetchError Code=1 "No AutoShortcuts instance registered." UserInfo={NSLocalizedDescription=No AutoShortcuts instance registered.} I've attached a sample project to my FA-post FB10199299
Replies
5
Boosts
1
Views
2.7k
Activity
Aug ’22
[Possible is bug] @Parameter(requestValueDialog:) doesn't shows value in dialog view when user set value: ask every time
I had the next intent: struct Intent: AppIntent { static var title: LocalizedStringResource = "Intent" static var openAppWhenRun: Bool = true @Parameter(title: "Title", requestValueDialog: .init("Dialog")) var entity: [Entities] @MainActor func perform() async throws -> some IntentResult { // return result } } Is it a bug in the AppIntents framework? Because I don't understand why I don't see parameter value when the user set this option
Replies
0
Boosts
0
Views
821
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
iOS 16 App Intents - Is it possible to have different results?
Hi, I am building a series of App Intents with the new SDK, and I keep facing the issue that in some cases I want to return a result with dialog, others without or others can open an intent. Here I get an error because I am not specifying in the signature that OpensIntent, but if I do so, I cannot keep the other result simple. func perform() async throws -> some IntentResult  {         do {             try ShortCutsManager.shared.scrollToNextStep()             return .result()         } catch let error {             if let shortcutError = error as? ShortCutsManagerError, shortcutError == ShortCutsManagerError.noMoreSteps {                 return .result(opensIntet: NewIntent())             }             throw error         }     } I made a work around, but then I cannot return a dialog in the second return, and say "well done" func perform() async throws -> some IntentResult  {         do {             try ShortCutsManager.shared.scrollToNextStep()             return .result()         } catch let error {             if let shortcutError = error as? ShortCutsManagerError, shortcutError == ShortCutsManagerError.noMoreSteps {                 try await requestConfirmation(output: .result(dialog: "Do you want to mark this recipe as cooked?"){                     EmptyView()                 })                 try doSomething()                 return .result("well done!")             }             throw error         }     } is this even possible? Or is it at least consider for a close future? thanks a lot in advance
Replies
0
Boosts
0
Views
1.2k
Activity
Jul ’22
How to make Siri read new App Intenta Dialogs
I am creating new intenta with the new framework. So far is working fine. But the dialog is only show in preview. How can I make Siri to read at loud the text in Dialog? thanks a lot in advance
Replies
0
Boosts
0
Views
621
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
Use New AppIntents Framework Not Work to Show Shortcuts
I have set Xcode preference Command line Tools to Xcode14.0, but is not work, so What's wrong with me?Environment configuration or certificate authority ? This is My Code : import Foundation import SwiftUI import AppIntents struct ShowMyProgressIntent: AppIntent { static var title: LocalizedStringResource = "Show Sport Progress" @MainActor func perform() async throws -> some IntentPerformResult { return .finished { ProgressView() } } } struct StartSportActivityIntent: AppIntent { static var title: LocalizedStringResource = "Start Sport Activity" static var openAppWhenRun: Bool = true // Open app directly @Parameter(title: "Activity") var activity: SportActivity @MainActor func perform() async throws -> some IntentPerformResult { let model = SportActivityModel(type: activity) ViewModel.shared.navigateTo(model: model) return .finished(value: true) } } struct SportLogShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: ShowMyProgressIntent(), phrases: [ "Show My Progress in (.applicationName)", "Start running now" ] ) } }
Replies
0
Boosts
0
Views
987
Activity
Jun ’22