- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我在 Xcode 10(iOS 12 Beta)中提供自定义意图时遇到问题。
我已经创建了一个在我的主要应用程序目标和我的“OrderIntent”目标之间共享的自定义框架。
我创建了一个 .intentdefinition 文件,目标成员设置为我的自定义框架(下面的屏幕截图)。
我在主应用程序中嵌入了“Intents Extension”和“Intents UI Extension”。
我还在添加意图扩展时创建的两个 info.plist 文件中的 NSExtension->NSExtensionAttributes->IntentsSupported 添加了“OrderIntent”(下面的屏幕截图)。
我正在尝试像这样捐赠意图:
INPreferences.requestSiriAuthorization { (status) in
if status != INSiriAuthorizationStatus.authorized {return}
let orderIntent = OrderIntent()
orderIntent.product = "Test product"
orderIntent.quantity = 2
let interaction = INInteraction(intent: customIntent, response: nil)
interaction.donate { (error) in
if error != nil {2
if let error = error as NSError? {
print(error)
}
} else {
print("success")
}
}
}
上面的代码在用户点击应用中的按钮时运行。
我还像这样设置了意图处理程序:
class IntentHandler: INExtension {
override func handler(for intent: INIntent) -> Any {
switch intent {
case is OrderIntent:
return OrderIntentHandler()
default:
fatalError()
}
return self
}
OrderIntentHandler 是这样的:
public class OrderIntentHandler: NSObject, OrderIntentHandling {
public func handle(intent: OrderIntent, completion: @escaping (OrderIntentResponse) -> Void) {
let orderIntentResponse = OrderIntentResponse(code: OrderIntentResponseCode.success, userActivity: nil)
completion(orderIntentResponse)
}
public func confirm(intent: OrderIntent, completion: @escaping (OrderIntentResponse) -> Void) {
let response = OrderIntentResponse(code: OrderIntentResponseCode.ready, userActivity: nil)
completion(response)
}
}
在设备上测试时,出现以下错误:
Error Domain=IntentsErrorDomain Code=1901 "Donating intent 'OrderIntent' is not supported by this application. Please make sure that you have an extension that supports this intent." UserInfo={NSLocalizedDescription=Donating intent 'OrderIntent' is not supported by this application. Please make sure that you have an extension that supports this intent.}
我不明白为什么应用程序不支持“OrderIntent”。
我已经在功能选项卡中启用了 Siri 并请求了用户的许可等。
是否需要采取任何其他步骤才能让我捐赠 intent?
最佳答案
我相信你的问题的答案在你的描述中是正确的(强调我的):
I've created a .intentdefinition file with the target membership set to my custom framework
我假设执行调用 interaction.donate
的代码在您的应用程序中,而不是在共享框架中。如果是这种情况(根据 your answer 判断您如何解决该问题),您还需要将主应用程序添加为 .intentdefinition
文件中的目标。您将希望没有生成的类,因为它们已经在您的应用程序链接到的共享框架中。您可能遇到了问题,因为看起来您在单独的 Xcode 项目中创建了共享框架,因此其他目标不可见。
关于ios - SiriKit 错误 : Donating intent is not supported by this application,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50817087/
上下文 我正在努力为一个重要的应用程序添加对 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
我是一名优秀的程序员,十分优秀!