参考链接:https://blog.csdn.net/wuyangyang555/article/details/101285410
新建swift APP后, 设置rootviewcontroller 为其他Controller,如果 勾选的是main.storyboard 运行app ,删除后main.storyboard会有黑屏问题。
1.检查info.plist 文件
首先我们去到info.plist,删掉如下图箭头所示
2.删除SceneDelegate.swift 文件
3.删除APPdelegate.swift 中 与Scene相关的代码
4.在APPdelegate.swift里面添加window属性
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
/**
*入口区,调用区
*/
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = vc
window?.makeKeyAndVisible()
return true
}
}
5.完成