- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试弄清楚如何使用 iOS12 中的自定义意图来定义和创建快捷方式。我想创建一个快捷方式,以便用户可以将任务添加到我的应用程序并为其命名(以及将来的其他参数)。例如只需对 Siri 说“添加名称为‘取洗衣物’的任务”。
然后我尝试使用以下方法创建 Siri 快捷方式:
TaskIntent *taskIntent = [[TaskIntent alloc] init];
taskIntent.suggestedInvocationPhrase = @"TaskIt";
INShortcut *taskShortcut = [[INShortcut alloc] initWithIntent:taskIntent];
INUIAddVoiceShortcutViewController *addSiri = [[INUIAddVoiceShortcutViewController alloc] initWithShortcut:taskShortcut];
addSiri.delegate = self;
[self presentViewController:addSiri animated:YES completion: nil];
但是,它最终在应用程序中出现异常:
Cannot create shortcut from intent ( { taskName = ; identifier = EE4661C6-1826-4A14-84EC-FD684647FE2B; }) because it has no valid parameter combinations
所以我不确定如何正确执行此操作。捐赠快捷方式时是否必须提供任务名称?但这意味着每次都会显示相同的 taskName 并将其添加到系统中,这不是我想要的。还是新的 SiriKit 的可定制性不足以处理通用输入?
最佳答案
是的,在创建了您的自定义 TaskIntent
之后,您需要填充其参数。也就是你需要为taskName
设置一个值:
taskIntent.taskName = @"Test";
每次用户在您的应用中执行相关操作时,您都会捐赠意图。如果您的用户使用 taskName
输入任务,您可以通过创建您的意图并将 taskIntent.taskName
参数设置为用户输入的任务名称来捐赠此任务名称。它将建议再次输入具有相同标题的任务的快捷方式,这可能不是您想要的。添加任务不是重复的,因为任务标题不同,没有什么可以预测的,所以 INAddTasksIntent
似乎比捐赠快捷方式更合适。
关于ios - SiriKit 自定义意图参数和快捷键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51375013/
上下文 我正在努力为一个重要的应用程序添加对 Siri 快捷方式(Intents?)的支持。我的主要目标是允许用户使用 Shortcuts.app 自动执行应用程序中的某些任务。 我在 Intents
我目前正在我的应用程序中添加 SiriKit,并且我已经创建了一个 INExtension 类。在我的 Info.plist 中,我有以下代码。 但是每次我尝试在设备上运行 Intent Extens
我正在尝试弄清楚如何使用 iOS12 中的自定义意图来定义和创建快捷方式。我想创建一个快捷方式,以便用户可以将任务添加到我的应用程序并为其命名(以及将来的其他参数)。例如只需对 Siri 说“添加名称
我刚刚创建了单 View Controller 应用程序并添加了带有 Siri 扩展(intents 和 intent ui 扩展)的目标。但是当我说 Siri 命令启动意图时,它只是启动应用程序而不
我将 SiriKit 添加到我的一个版本中,但后来决定将其删除。问题是,当我要求 Siri 执行该应用程序过去执行的功能时,Siri 仍然愿意使用我的应用程序。我已经删除并重新安装了该应用程序(不支持
我想了很多关于 Siri 如何改进我的应用程序的用户体验。 我正在编写一个专用于健身的应用程序,用于记录您的锻炼和个人记录。 我想让用户使用 Siri 来使用我的应用程序的功能,但我真的不明白这是否可
我有一个应用程序,用户可以在其中订购咖啡。我阅读了以下有关 SiriKit 支持的基本域的文章 - https://developer.apple.com/documentation/sirikit
我发出的任何通过 Siri 向联系人汇款的请求都会触发网络搜索,将语音输入传递给 Safari(即“向 Bob 汇款 100 美元”)。 我已在我的应用功能中启用 Siri,并将 INSendPaym
我在 Xcode 的 Capabilities 中启用了 Siri,我还将 NSSiriUsageDescription 添加到我的父应用程序 plist 文件中,并在我的第一个 Controller
我在 wwdc 上观看了 SiriKit 并阅读了文档。 https://developer.apple.com/library/prerelease/content/documentation/In
我构建了 Intents Extension,我正在处理 INSendMoneyIntent,我说: Send 25€ to John Smith 应用确认后的响应 Here's your paym
我有一个道路救援服务应用程序。它具有一些类似于乘车预订应用程序(例如优步)的功能。我可以在多大程度上利用 iOS 10 Sirikit?可能是,苹果可以拒绝它。但我需要知道技术可行性。 我的应用程序的
IntentHandler类: import Intents class IntentHandler: INExtension, INStartWorkoutIntentHandling {
我想在我的一个应用程序中实现录音功能。可以使用sirikit吗?我目前没有找到任何通过 sirikit 录音的教程。 有人可以提供关于sirikit的好的教程吗? 最佳答案 正确地知道您不能通过以下方
我正在将SiriKit集成到我的iOS 13应用程序中。 为此,我使用Apple's Sample app - Soup Chef来理解它。 在我的自定义意图中,我在快捷方式应用程序中选择了Ask E
我有一个问题,Siri 总是用我的意图的英文版本来回应。我创建了一个演示项目来分离出相关代码: 我的项目中有 3 个目标: .intentsdefinition文件位于框架 (Base) 中,并且类也
我一直在开发一个应用程序,尝试实现 requestPaymentIntent。它首先可以工作,但在某个时候它开始进行 Bing 搜索,并且在某个时候只是说它发现了一个错误,之后什么也不做。主题中也指出
我正在尝试实现一个航空公司应用程序,它将以文本方式对讲并为用户返回里程。我正在使用 INSearchForAccountsIntentHandling 协议(protocol)来实现它。 就像我希望
我正在使用测试应用程序和扩展来尝试 SiriKit 驱魔。我的分机根本没有被调用,我不知道为什么。我在另一个应用程序中有一个工作的 SiriKit 扩展程序,它莫名其妙地停止响应 - 因此这个测试应用
在我第一次构建并运行我的 intents 项目后,从 Siri 请求某些东西总是返回抱歉,您需要在应用程序中继续 但是,在我重建之前,它每次都有效。 我在处理程序中放置了断点: override fu
我是一名优秀的程序员,十分优秀!