“需要新构建系统”的 SwiftUI 预览错误

问题描述 投票:0回答:1

我的环境是: Xcode 15.0 斯威夫特5 最低部署:iOS 13 我的项目是 UIKit,但是当我使用 SwiftUI 文件时,出现错误“需要新的构建系统”,如何修复它? enter image description here

我找不到在哪里修改新构建系统,有我的工作区设置: WorkSpace setting

这是预览版的完整诊断

== DATE:

Friday, October 25, 2024 at 17:14:41 China Standard Time

2024-10-25T09:14:41Z

== 暂停原因:

initial

== 待更新原因:

Data Sources changed
Data Sources changed
Data Sources changed
Open file was edited
Preview Settings changed
Current scheme changed
Current scheme changed
Preview Settings changed
Open file was edited
Workspace build settings changed
Workspace build settings changed
Preview Settings changed

== 预览更新错误:

NeedXCBuildError: New build system required

The new build system is required for using Xcode previews

== 版本信息:

Tools: 15C500b
OS:    22H123
PID:   7674
Model: Mac mini
Arch:  arm64e

== 环境:

openFiles = [
    /Users/kim/Desktop/TradeBook_App/TradeBook/NewWidget/EmptyDataView.swift
]
wantsNewBuildSystem = false
newBuildSystemAvailable = true
activeScheme = TradeBook
activeRunDestination = Any iOS Device variant iphoneos undefined_arch
workspaceArena = [x]
buildArena = [x]
buildableEntries = [
    NewWidgetExtension.appex
]
runMode = Dynamic Replacement

== 选择的跑步目的地:

name = Any iOS Device
eligible = false
sdk = Optional(<DVTSDK:0x142722fe0:'iphoneos17.2':iOS 17.2:<DVTFilePath:0x6000023f3020:'/Users/kim/Downloads/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk'>>)
variant = Optional("iphoneos")
device = Optional(<DVTiPhonePlaceholder: 0x14272f140 (Any iOS Device | undefined_arch)>)

== 电源状态日志:

2024/10/25, 17:09 Received power source state: Externally Powered
2024/10/25, 17:09 No device power state user override user default value.Current power state: Full Power
swiftui preview xcode15
1个回答
0
投票

我刚刚遇到了同样的问题,结果发现它是一个旧的工作区构建设置,似乎不再在 Xcode GUI 中公开(位于文件:workspace_name.xcworkspace -> xcshareddata -> WorkspaceSettings.xcsettings)。我完全删除了 xcsettings 文件,Xcode 现在按预期工作。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.