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

Xcode14.3 Widget预览报错及App内可编辑Widget实现求助

SwiftUI Widget预览失败与App内可编辑Widget实现求助

环境与需求

  • 零基础SwiftUI开发者,使用Xcode 14.3开发跨iOS、macOS的倒计时App
  • 核心需求:App内每个倒计时事件以可配置的小型Widget形式展示,点击Widget可进入编辑界面
  • 当前问题:无法在非模拟器环境下预览Widget或Widget上下文内容

项目结构

  • 除CountWidgetView外,所有文件均由Xcode自动生成
  • ContentView与当前Widget相关代码无关联

具体报错信息

1. CountWidgetView(目标成员:Propedium (App))

预览报错:

Could not find a host (app, extension, framework) given the open files and active 'PreviewProvider' types. Make sure the open files and 'PreviewProvider' types are targets in the active scheme

2. PropediumWidgetMacOS(目标成员:PropediumWidgetMacOSExtension)

预览报错:

No plugin registered to launch the process type widgetExtension

已尝试的无效操作

  • 为PropediumWidgetMacOSExtension链接Intent.framework
  • 调整文件的目标成员归属
  • 移除代码中的@main标记

求助方向

  1. 解决上述两个Widget预览报错的具体方案
  2. 实现「App内可点击编辑的小型Widget」的替代技术方案

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.25 04:02:05