You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 13:15:56