简体   繁体   English

SwiftUI Canvas:自动预览更新暂停,无法恢复

[英]SwiftUI Canvas: Automatic Preview Updating Paused, Can't resume

I'm working on my app in XCode 13, with a target deployment of iOS 13. I'm trying to implement SwiftUI, but all Canvases refuse to load.我正在 XCode 13 中开发我的应用程序,目标部署为 iOS 13。我正在尝试实现 SwiftUI,但所有画布都拒绝加载。 If I select Resume, the preview will pause again without ever loading.如果我 select 恢复,预览将再次暂停而不会加载。 There are no error messages, the preview just pauses again.没有错误消息,预览只是再次暂停。

I found a similar question on here, but none of the solutions have worked for me.我在这里发现了一个类似的问题,但没有一个解决方案对我有用。 My account isn't at the level yet where I could leave a comment on it.我的帐户还没有达到可以发表评论的水平。

So far I have tried the following:到目前为止,我已经尝试了以下方法:

  • Set Enable Previews in build settings to "Yes"将构建设置中的启用预览设置为“是”
  • Checked off "For install builds only" on all possible items in Build Phases在构建阶段中的所有可能项目上勾选“仅用于安装构建”
  • Wrapped build phases scripts in an if statement to check if Previews are enabled在 if 语句中包装构建阶段脚本以检查是否启用了预览
  • Made a clean build, cleared all derived data.进行了干净的构建,清除了所有派生数据。
  • Deleted local repository copy and reinstalled from GitHub删除本地存储库副本并从 GitHub 重新安装
  • Restarted computer重新启动计算机
  • added #if DEBUG and #endif to preview code添加了#if DEBUG 和#endif 来预览代码
  • Made sure Xcode is not in Legacy Build system.确保 Xcode 不在旧版构建系统中。

Other Info:其他信息:

  • App does not use CoreData, and the previews do not involve API calls. App不使用CoreData,预览版不涉及API调用。
  • App is rather large, its size might have something to do with it?应用程序比较大,可能与它的大小有关?
  • Xcode will not even show preview for basic "Hello World." Xcode 甚至不会显示基本“Hello World”的预览。 default SwiftUI view.默认 SwiftUI 视图。

I'm kind of at a loss at this point as to what else to try.在这一点上,我有点不知所措,不知道还能尝试什么。

Please let me know if you have any other questions or suggestions.如果您有任何其他问题或建议,请告诉我。

Creating a new SwiftUI file was the only thing that worked for me.创建一个新的 SwiftUI 文件是唯一对我有用的东西。 You can delete it again after the preview recompiles.您可以在预览重新编译后再次删除它。

Take a look at the process SimRenderServer in activity monitor, I think it's this run that Xcode has to relaunch.看看活动监视器中的SimRenderServer进程,我认为 Xcode 必须重新启动这个运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM