最佳答案
第 1 步:- 您需要从 info.plist 中删除场景委托(delegate)的依赖项 (按照上面 Dipak Ramoliya 的 Ans 中显示的步骤)
第 2 步:- 场景委托(delegate)文件中的注释代码
第 3 步:- 注释App delegate文件中场景委托(delegate)相关的代码(connectingSceneSession方法和sceneSessions方法)
第 4 步:- 在 AppDelegate 文件中添加窗口变量(var window: UIWindow?)
第 5 步:- 在 App Delegate 的 didFinishLaunchingWithOptions 方法中创建 rootViewController
例如:-
let appDelegate = UIApplication.shared.delegate as! AppDelegate
var rootVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "testController") as! TestController
appDelegate.window?.rootViewController = testController
关于iOS : Black screen appears when run my app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70617739/