删除 SceneDelegate
2021-02-04 本文已影响0人
落落2023
Xcode11之后新创建的工程会多出文件SceneDelegate,变回之前工程需要以下操作
一、工程删除SceneDelegate文件
![](https://img.haomeiwen.com/i1748692/ae77eb28791e63dc.png)
直接删除SceneDelegate.h
和SceneDelegate.m
文件此时
会报错There is no scene delegate set. A scene delegate class must be specified to use a main storyboard file.
二、修改info.plist
Info.plist
直接删除Application Scene Manifest
![](https://img.haomeiwen.com/i1748692/3847153aa59f0f76.png)
或将Info.plist
-> Open As
-> Source Code
将划框的部分删除。
![](https://img.haomeiwen.com/i1748692/fd51310c443db086.png)
三、修改AppDelegate
1.在AppDelegate.m
中的UISceneSession lifecycle
注释掉或者删掉
![](https://img.haomeiwen.com/i1748692/99b29af28650cded.png)
2.在AppDelegate.h
添加window属性
@property (nonatomic, strong) UIWindow *window;
此时,确保TRGETS
->Main interface
为Main
![](https://img.haomeiwen.com/i1748692/07ef9a7cc71e4162.png)
运行即ok
或者在AppDelegate.h
添加window属性后,在AppDelegate.m
加载自定制的控制器,(TRGETS
->Main interface
为Main
非必须)可选方式很多以下仅供参考
![](https://img.haomeiwen.com/i1748692/814d4b0dbcbf8722.png)
运行即ok