简体   繁体   English

Swift UI(Xcode 12 Beta):无法构建 ContentView.swift

[英]Swift UI(Xcode 12 Beta): Failed to built ContentView.swift

I tried to write my first app with Swift UI but I failed at updating preview and the simulator still worked, couldn't figure out why.我尝试使用 Swift UI 编写我的第一个应用程序,但是我无法更新预览并且模拟器仍然有效,无法弄清楚原因。 I've searched for solutions like sudo xcodebuild -license and assigning the Command Line Tools to Xcode 12 Beta, which didn't work at all.我已经搜索了诸如sudo xcodebuild -license并将命令行工具分配给 Xcode 12 Beta 之类的解决方案,但根本不起作用。 Sorry for my bad English.对不起,我的英语不好。 enter image description here在此处输入图片说明

I've tried to replicate the issue you had and it seems that the project name is the problem.我试图复制您遇到的问题,似乎项目名称是问题所在。 As Andrew mentioned in the comments, try is a reserved keyword in Swift.正如Andrew在评论中提到的, try是 Swift 中的保留关键字。 Choose a better name for your project and everything will work correctly.为您的项目选择一个更好的名称,一切都会正常工作。

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

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