简体   繁体   English

对目标 macOS 10.15 使用 Xcode 12 构建错误

[英]Using Xcode 12 build errors for target macOS 10.15

As of Xcode 12.3, when you create a new SwiftUI project with a target of macOS, Xcode defaults the target to 11.0 (Big Sur).从 Xcode 12.3 开始,当您以 macOS 为目标创建新的 SwiftUI 项目时,Xcode 默认目标为 11.0(Big Sur) Without changing a line of code in the default "hello world" app created by default, I then change the target to macOS 10.15 (which is what I am still using) The default project swift file will no longer build.:-在不更改默认创建的默认“hello world”应用程序中的一行代码的情况下,我将目标更改为 macOS 10.15(我仍在使用)默认项目 swift 文件将不再构建。:-


@main
struct catalinaApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}```

3 Errors: @main, 'Scene' and WindowGroup is only available in macOS 11.0 or newer

How can I alter the project/above file to correctly build the default app on Catalina? (10.15) ?

thanks in advance!

Thanks to @Raja Kishan, the answer is simply to choose the App Delegate option in the choices for Lifecycle when creating a new project.感谢@Raja Kishan,答案就是在创建新项目时在 Lifecycle 的选项中选择 App Delegate 选项。

暂无
暂无

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

相关问题 C++ 在 Xcode OSX 上构建失败,出现多个错误文件 IO ... 不可用:在 macOS 10.15 中引入 - C++ Build Failed on Xcode OSX with multiple errors File IO … is unavailable: introduced in macOS 10.15 我可以使用 Xcode11 构建我的应用程序的 MacOS 版本,它可以在 10.15 之前的任何版本上运行吗? - Can I build a MacOS version of my app that will run on anything earlier than 10.15 using Xcode11? 使用 XCode 12 构建错误 - Build errors with XCode 12 macOS 12 上的运行时错误“在平面命名空间中找不到符号”,但 macOS 10.15 上没有,同时具有 Xcode 和 CMake 版本 - runtime error ‘symbol not found in flat namespace’ on macOS 12 but not macOS 10.15, with both Xcode and CMake builds 在 MacOS 10.15 Catalina 上安装 XCode - Install XCode on MacOS 10.15 Catalina 升级到 MacOS Catalina 10.15 后尝试从 Xcode 11.1 部署到设备时,FIPS 出现两个错误 - Two errors with FIPS when trying to deploy to device from Xcode 11.1 after upgrading to MacOS Catalina 10.15 Xcode 11.3 在 macOS Catalina 10.15 中启动时崩溃 - Xcode 11.3 crashes on launch in macOS Catalina 10.15 macOS Catalina 10.15 xcode openGL 没有运行 window? - macOS Catalina 10.15 xcode openGL not running window? Xcode 12 模拟器的构建目标顺序错误? - Xcode 12 build target in wrong order for simulator? 将目标添加到 iOS/macOS 多平台项目 (Xcode 12) - Add target to iOS/macOS Multi-Platform Project (Xcode 12)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM