Xcode 11 Beta 3,生成错误“未知属性“状态"",“使用未声明类型的“视图""等等 [英] Xcode 11 Beta 3, build error "Unknown attribute 'State'", "Use of undeclared type 'View'" etc

查看:229
本文介绍了Xcode 11 Beta 3,生成错误“未知属性“状态"",“使用未声明类型的“视图""等等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用SwiftUI用Xcode 11的第二个beta构建了一个应用程序,并且一切工作都很好,但是现在,有了第三个beta,该应用程序甚至都没有构建.我收到诸如使用未声明的类型'视图','未知属性'状态'"之类的错误消息,该怎么办?是我的代码中的问题,还是仅仅是一个错误?

I build an app with the 2nd beta of Xcode 11, using SwiftUI, and everything worked completely fine, but now, with the 3rd beta, the app isn't even build. I get errors like "Use of undeclared type 'View'", "Unknown attribute 'State'" etc. What can I do? Is the problem in my code or is it just a bug?

问题是当我试图构建要在Mac上运行(与Mac版UIKit一起使用)的应用

@State var score = 0

错误是未知属性'状态'"

The error is "Unknown attribute 'State'"

struct ContentView : View {
    /*...*/
}

错误是使用未声明的类型'视图'"

The error is "Use of undeclared type 'View'"

推荐答案

这来自 Xcode 11 Beta 3发行说明.

已知问题

  • Xcode 11不支持在macOS附带的iPad应用中使用SwiftUI. (41416222,51201699)

Known Issues

  • Xcode 11 doesn’t support working with SwiftUI in an iPad app brought to macOS. (41416222, 51201699)

我只是为了确认您提到的错误而自己下载了Xcode 11 Beta 3,并且在尝试为Mac构建SwiftUI项目时遇到了相同的问题.

I downloaded the Xcode 11 Beta 3 myself just to confirm the errors you mentioned, and I had the same issues when trying to build a SwiftUI project for Mac.

如果可能的话,我建议重新使用Xcode Beta 2.不幸的是,Apple不提供指向先前Beta的下载链接,因此希望您的计算机上仍安装了Time Machine备份或Beta 2.否则,在发布下一个测试版之前,您可能会很走运.

I would suggest going back to using Xcode Beta 2 if possible. Unfortunately, Apple doesn't provide download links to previous betas, so hopefully you have a Time Machine backup or Beta 2 still installed on your computer. Otherwise, you might be out of luck until the next beta is released.

这篇关于Xcode 11 Beta 3,生成错误“未知属性“状态"",“使用未声明类型的“视图""等等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆