Post

Replies

Boosts

Views

Activity

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.8k
Sep ’22