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

Widget动态选项异常:“No options were provided for this parameter”报错排查

Widget动态选项传递失败:"No options were provided for this parameter" 错误排查

当Widget使用自定义类型并启用动态选项时,运行时选项无法正确传递至组件,触发**"No options were provided for this parameter"**错误。原本计划从CoreData获取数据,但即便直接硬编码赋值,依然无法获取到选项数据。

相关代码与配置

IntentHandler代码

class IntentHandler: INExtension, CreateItemConfigurationIntentHandling {
  let context = PersistenceController.shared.container.viewContext

  func provideTagsOptionsCollection(for intent: CreateItemConfigurationIntent, with completion: @escaping (INObjectCollection<WidgetTag>?, Error?) -> Void) {
    let options = [
      WidgetTag(identifier: "option1", display: "Option 1"),
      WidgetTag(identifier: "option2", display: "Option 2"),
      WidgetTag(identifier: "option3", display: "Option 3")
    ]
    
    let collection = INObjectCollection(items: options)
    completion(collection, nil)
  }
}

.intentdefinition文件配置

参数tags设置为自定义类型WidgetTag,已勾选Dynamic Options,并指定选项提供方法为provideTagsOptionsCollection。

目标设置

  • .intentdefinition文件的Target Membership已勾选Widget Extension和Intent Extension;
  • IntentHandler所在文件的Target Membership已勾选Intent Extension。

内容的提问来源于stack exchange,提问作者IDTIMW

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.24 09:37:53