iOS : Black screen appears when run my app

标签 ios swift

实际上enter image description here当我运行我的 iOS 应用程序时,它会出现这样的黑屏。我从 appdelegate 中删除了场景委托(delegate)文件和函数,但它仍然显示黑屏。有什么想法吗??

最佳答案

第 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/

相关文章:

ios - 以编程方式访问 Interface Builder 中添加的 UIView 的 subview

ios - 自定义容器 ViewController 标志 isMovingToParentViewController 不起作用

iOS : Audio is missing in exported video

ios - 终止应用程序 : Could not load NIB in bundle: 'NSBundle ...' with name '7bK-jq-Zjz-view-r7i-6Z-zg0'

ios - UIView 数组

ios - navigationBarItems 中的 SwiftUI NavigationButton

ios - 从 iPhone 设置中删除应用程序

ios - 删除表格单元格时重新加载详细 View - Swift

regex - 如何省略正则表达式模式过滤字符?

ios - 为自定义 View 调用 NSBundle(使用 loadNibName)后访问 IBOutlet 的最佳方法