iOS Intents动态参数加载失败且handle方法未调用问题
SiriKit快捷指令动态参数点击报错问题
在苹果快捷指令App中,点击快捷指令内动态提供的参数时,弹出**‘An unknown error occurred.’**错误,且handle(intent: TestIntent) async -> TestIntentResponse方法未被调用。我已实现Xcode提供并生成的Handling协议,相关代码如下:
class SiriKitAppClosingIntentHandler: NSObject, LogAppClosingIntentHandling { func provideAppOptionsCollection(for intent: LogAppClosingIntent, searchTerm: String?) async throws -> INObjectCollection<SiriKitIntentAppName> { let appOptionsCollection = AppName.appOptionsCollection if let searchTerm = searchTerm, !searchTerm.isEmpty { return INObjectCollection(items: appOptionsCollection.filter({ $0.displayString.contains(searchTerm) })) } else { return INObjectCollection(items: appOptionsCollection) } } func handle(intent: LogAppClosingIntent) async -> LogAppClosingIntentResponse { print(" closing intent \(intent) \(#file) \(#line)") return LogAppClosingIntentResponse(code: .success, userActivity: nil) } }

内容的提问来源于stack exchange,提问作者YodagamaHeshan
相关产品推荐
相关产品推荐

