删除info.plist里面的Application Scene mainifest
删除SceneDelegate.swift
删除AppDelegate.swift里面的这两个方法
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
然后在appDelegate,swift里面添加
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?//添加window
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.main.bounds)
// 设置根视图控制器
var VC = UIViewController()
VC.view.backgroundColor = UIColor.blue
let rootViewController = VC // 替换为你的视图控制器
window?.rootViewController = rootViewController
window?.makeKeyAndVisible()//让window可以被看见
return true
}
}