简体   繁体   中英

iOS Simulator not running app, only showing a black screen

I'm running my app, and it has no errors. The simulator is only showing a black screen.

在此处输入图片说明

Has this happened to anyone? How do you fix it? By the way, this is after I launch my app from the home screen.

  1. Do you have an error message?
  2. If not, then try one of the following article about cleaning XCode cash and how-to reset the simulator:

There is also an app Xcode Cache Clean

You can Reset Content and Settings from top left . This may help you solve the problem.

I've recently had this same problem with a project I was migrating from Swift 3 to Swift 4.2. The problem was the method signatures on AppDelegate , specifically the didFinishLaunchingWithOptions , which I had to change from:

private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

To:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

This solved the issue. The simulator (and device) showed a black screen because didFinishLaunchingWithOptions was not executed. Consequently, the UIWindow.rootViewController was not set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM