参数化应用程序快捷方式未在 Spotlight 中正确显示 (iOS 17)

ale*_*ner 6 ios swift sirishortcuts appintents ios17

我\xe2\x80\x99m 致力于支持 iOS 17\xe2\x80\x99s 新的快捷方式功能。我有多个应用程序快捷方式,包括一个在选定选项卡中启动应用程序的快捷方式。选项卡选择是通过AppView符合AppEnum协议的自定义枚举完成的。

\n

问题是,由于某种原因,在视图 XYZ 中打开操作无法在 Spotlight 中正确显示\xe2\x80\x99。正如您在下面的屏幕截图中看到的,它没有任何图标或标题。此外,在“快捷方式”应用程序本身中,仅显示第一个短语产生的操作。基于短语的操作AppView仅显示为下面的旧应用程序快捷方式。

\n

知道如何解决这个问题吗?

\n

应用程序快捷方式定义

\n
struct AppShortcuts: AppShortcutsProvider {\n    static var shortcutTileColor: ShortcutTileColor = .grape\n    \n    static var appShortcuts: [AppShortcut] {\n        AppShortcut(\n            intent: OpenAppIntent(),\n            phrases: [\n                "Open \\(.applicationName)",\n                "Open \\(\\.$view) in \\(.applicationName)"\n            ],\n            shortTitle: "Open",\n            systemImageName: "arrow.up.forward.app"\n        )\n        // Other App Shortcuts \xe2\x80\xa6\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

AppView应用枚举

\n
extension AppView: AppEnum {\n    static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "View")\n    \n    static var caseDisplayRepresentations: [Self : DisplayRepresentation] = [\n        .insights: DisplayRepresentation(title: LocalizedStringResource("Insights", table: "Shortcuts", comment: "App View Label"),\n                                         image: .init(systemName: "chart.xyaxis.line")),\n        .events: DisplayRepresentation(title: LocalizedStringResource("Events", table: "Shortcuts", comment: "App View Label"),\n                                       image: .init(systemName: "calendar")),\n        .meters: DisplayRepresentation(title: LocalizedStringResource("Meters", table: "Shortcuts", comment: "App View Label"),\n                                       image: .init(systemName: "barometer"))\n    ]\n}\n
Run Code Online (Sandbox Code Playgroud)\n

快捷方式定义

\n
struct OpenAppIntent: AppIntent {\n    \n    // Launches app when action is triggered\n    static let openAppWhenRun: Bool = true\n    \n    // App View Parameter\n    @Parameter(title: "View",\n               description: "The view inside the app.",\n               default: .insights,\n               requestValueDialog: IntentDialog("Where would you like to navigate to?"))\n    var view: AppView\n    \n    // Title, Description, Parameter Summary & perform()\n}\n
Run Code Online (Sandbox Code Playgroud)\n

截图

\n\n\n

ale*_*ner 0

向 Apple 提交反馈 (FB13157399) 后,此问题在 iOS 17.1 Beta 2 中得到修复。

\n

现在我只在执行实际快捷方式时得到 a WFBackgroundShortcutRunnerErrorDomain error 1,但这也可能与它仍然是 beta\xe2\x80\xa6 的事实有关

\n