当前位置: 首页 > news >正文

[SwiftUI]工程最低适配iOS13

问题:

新建工程,选择最低支持iOS13报错:

'main()' is only available in iOS 14.0 or newer

'Scene' is only available in iOS 14.0 or newer

'WindowGroup' is only available in iOS 14.0 or newer

解决:

注释掉上面代码,重新创建一个AppDelegate作为入口:

import Foundation
import SwiftUI@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {var window: UIWindow?func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {// 创建一个UIHostingController来托管你的ContentViewlet contentView = ContentView()// 设置windowlet window = UIWindow(frame: UIScreen.main.bounds)window.backgroundColor = .whitewindow.rootViewController = UIHostingController(rootView: contentView)self.window = windowwindow.makeKeyAndVisible()return true}
}

info.plist中移除Application Scene Manifest

然后,重新运行就没问题了

http://www.lryc.cn/news/274365.html

相关文章:

  • MyBatis-Plus框架学习笔记
  • 【Java】——期末复习题题库(六)
  • 【水文】实现四则运算的简易计算器
  • 计算机毕业设计-----ssm+mysql实现的JavaWeb酒店管理系统
  • 安防监控EasyCVR视频融合/汇聚平台大华热成像摄像机智能告警上报配置步骤
  • 关于“Python”的核心知识点整理大全64
  • Docker overlay2文件busy,容器不能删除问题解决
  • 栈的数据结构实验报告
  • ValueError: Could not find a backend to open path with iomode `wI` 解决
  • 小白入门基础 - spring Boot 入门
  • 探索Elasticsearch内存应用的关键因素
  • 关于简单的数据可视化
  • 透明OLED屏价格:影响因素与市场趋势
  • C++ 释放指针
  • 三数之和【双指针】
  • http 503 错误
  • MATLAB - MPC - 优化问题(Optimization Problem)
  • 机器学习中的概念 张量、标量、向量、矩阵等数据结构的区别
  • eureka注册列表 某服务出现多个服务实例
  • ubuntu22.04配置双网卡绑定提升带宽
  • VINS-MONO拓展1----手写后端求解器,LM3种阻尼因子策略,DogLeg,构建Hessian矩阵
  • RxJS 操作符-学习笔记
  • 【Linux】linux配置静态IP、动态IP方法汇总
  • Hive自定义函数支持国密SM4解密
  • CentOS 8 8.5.2111 网络在线安装系统 —— 筑梦之路
  • 安全与认证Week3
  • 跟我学c++中级篇——再谈C++20中的协程
  • 【计算机毕业设计】SSM企业工资管理系统
  • x-cmd pkg | doggo - 现代化的 DNS 客户端
  • c++-智能指针