Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS App Goes to Black Screen

I am using a Launch Screen storyboard as well as a Main storyboard in my Swift app. Sometimes the app will show the launch storyboard and then go to a black screen. Other times it correctly goes to the Main storyboard entry point. It almost seems like it is build-dependent in that if I clean and rebuild a few times, a build pop out that behaves properly. Any ideas what may be causing this?

To add some clarification:

  • The SplashScreen.storyboard is set in the target settings (good question).
  • This happens both on real devices and in simulator BUT NOT ALWAYS.
  • I am not doing any networking (synchronous or otherwise) in this stage
  • The blackout seems to happen only when transitioning to one specific view
  • The code for the view's viewWillDisplay and such executes even when blacked out, just nothing VISIBLE is displayed

This might help: I put in the following code in the offending view:

override func viewDidAppear(animated: Bool) {
    print(self.view.layer.bounds.width);
    print(self.view.layer.bounds.height);

}

When the black screen issue occurs, I get 260 and 17. When the view presents correctly, I get the 5s (simulator) dimensions of 320 and 568. Does that help anyone help me?

like image 828
Matt Ray Avatar asked Mar 07 '16 17:03

Matt Ray


People also ask

Why did my app screen go black?

One of the reasons behind the Android phone black screen won't turn on is the incompatible apps you have installed on your device. So, to fix the black screen problem, all you need to do is get rid of incompatible applications and programs from your Android device in safe mode.

Why does my screen go black when I open an app iPhone?

iPhone screen stuck black with a white Apple logo? If the iPhone screen goes black but shows a white  Apple logo before returning to normal, this indicates the device is rebooting. If that happens out of the blue, it usually suggests the iPhone is crashing or an app is crashing which causes the device reboot.


1 Answers

I was faced with the same issue in my device. I managed to fix it by setting the application's main interface via xcode: MyApplicationMain InterfaceLaunchScreen.storyboard (or Main.storyboard).

enter image description here

Cheers! :)

like image 64
Menelaos Kotsollaris Avatar answered Oct 10 '22 20:10

Menelaos Kotsollaris