我正在尝试测试目前在iOS16 Beta上的新AppIntents API。查看文档,实现似乎非常简单,但是在实现后,我没有在Shortcuts应用程序中看到我的AppIntent。设备正在运行iOS 16.0。
这是我实现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")
}
}
根据文档,快捷方式应该能够在我的应用程序安装后找到我的AppIntent,但我发现这并不是事实。有人知道我的实现缺少什么吗?
AppShortcutsProvider
)进行更改时,您需要删除应用程序(Xcode -> Product -> Clean Build Folder…),退出并重新启动快捷方式应用程序(macOS),或者重新启动模拟器(iOS/iPadOS)。您可能需要重复这个步骤一两次以使系统注意到其缓存已过期。 - Grant Neufeldreturn .result()
或return .result(value: "Done")
。 - alexkaessner