xcode 11 新建项目及配置
在xcode11中新建项目默认使用ios13 SDK创建,会直接将APP生命周期从APPdelegate转交给SceneDelegate
项目文件结构如下
├── yourProject // 项目文件│ ├── yourProject // 源码文件夹│ │ ├── AppDelegate.swift │ │ ├── SceneDelegate.swift │ │ ├── ViewController.swift │ │ ├── Main.storyboard │ │ ├── Assets.xcassets │ │ │ └── shop.png │ │ ├── LaunchScreen.storyboard │ │ ├── Info.plist
如果我们修改development target 低于13.0 编译项目就会报错,是由于新api(sceneDelegate)导致的,为此我们需要将生命周期还原为APPdelegate来管理,
打开info.plis删除Application Scene Manifest这一项
删除 SceneDelegate.swift 文件
将APPdelegate进行如下修改