Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Why does my app launch to a black screen on iOS 4?
Q: Why does my app launch to a black screen on iOS 4?
A: Why does my app launch to a black screen on iOS 4?
While setting your main window to be visible at launch has always been a requirement, earlier versions of iOS didn't strictly enforce this. In iOS 4, not setting your main window to be visible at launch will result in your application launching to a black screen and your main window not becoming the first responder.
If your app is launching to a black screen, make sure you have one of the following methods implemented.
In Xcode
In the App Delegate's -applicationDidFinishLaunching:
or -application:didFinishLaunchingWithOptions:
method, make sure you call [window makeKeyAndVisible]
.
This will set the main window as visible on launch and will make it the first responder.
In Interface Builder
If you have no need to use -applicationDidFinishLaunching:
or -application:didFinishLaunchingWithOptions:
, or you would rather set the window to be visible and the first responder in Interface Builder:
Open MainWindow.xib in Interface Builder.
Select the Window object in the Document window (see Figure 1).
On the Attributes tab of the Inspector palette, set the "Visible at Launch" checkbox to checked (see Figure 2).
Save MainWindow.xib.
Setting your main window to "Visible at Launch" in Interface Builder is the same as calling makeKeyAndVisible
on the window in Xcode. There is no need to have it set in both places. Choose the one that makes the most sense for your needs.
Document Revision History
Date | Notes |
---|---|
2010-07-28 | New document that shows how to resolve a black screen on launch by making your main window the first responder and visible on launch. |
Copyright © 2013 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2013-08-08