1、删除SceneDelegate类文件

2、删除info.plist文件的Application Scene Manifest配置

3、AppDelegate类文件添加window属性

4、删除AppDelegate类文件的UISceneSession相关代码

以上通过Storyboard创建rootViewController的方式,如果是通过代码创建,需要加一步在代理方法添加一下创建window的代码
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = ViewController()
window.backgroundColor = .white
window.makeKeyAndVisible()
self.window = window
return true
}
网友评论