Xcode 5 Simulator Blank White Screen

2019-04-12 02:15发布

I just installed Xcode 5 (or the latest version) and created a new project. I created a storyboard, and added a label, but when I open my application in the iPhone simulator, I simply get a blank white screen with a status bar. What am I doing wrong?

I have OS X 10.9.1 Mavericks.

enter image description here

7条回答
等我变得足够好
2楼-- · 2019-04-12 02:33

I know I'm quite late to this, but the solution to this problem is quite simple and is even shown in one of Apple's own tutorials.

Assuming that you started off with an "Empty Project", created a storyboard from scratch, and set your storyboard as the main interface, you need to remove a few lines in the first method of AppDelegate.m.

This:

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;

Should become just this:

    return YES;
查看更多
手持菜刀,她持情操
3楼-- · 2019-04-12 02:38

Just wanted to chime in on this thread and shed some light on the matter. I myself was working on my first project and was getting the white screen. I found this article and it helped and it didn't, but this is what worked for me. Everyone is right on what they posted, but I was running 9.2 simulator when in fact I only have 9.1 installed (if you need help with this go to Xcode> Preferences>Downloads and download the appropriate package. Once I did that I ran the simulator and got the white screen. Now my white screen had the carrier and batt icon at the top. To fix this issue in Simulator: Hardware>Device>9.1 and a reboot occurred and then it works...

Hope this helped.

SithAdmin

查看更多
时光不老,我们不散
4楼-- · 2019-04-12 02:43

Click "Main.storyboard" -> on right prat "Interface Builder Document" uncheck "Use Auto Layout, "Use Size Classes" & "Use as Lunch Screen"

查看更多
贪生不怕死
5楼-- · 2019-04-12 02:54

I had the same issue (blank screen) for a stupid simple error. Actually, the elements appeared and soon fade away. My mistake was that I was not creating in in Main.storyboard (but LaunchScreen.storyboard in place, so that it obviously disappeared couple of seconds after start). Stupid but at least, quick to check: create views in Main, not LaunchScreen...

查看更多
再贱就再见
6楼-- · 2019-04-12 02:55

EDIT TO FIX:

If you would like to fix this, remove the property "Main nib file base name." This can be found in the "info" tab of your target.

enter image description here

The problem:

It seems that when you created your application, you selected the "Empty Application" template. Then you added the Storyboard from the user interface section. When you added the label and ran the application, you can't see the "Hello, World" label, because the application does not have a root view controller at the end of the application launch.

Try to create a "Single View Application".

查看更多
萌系小妹纸
7楼-- · 2019-04-12 02:56

Your project does not have a view controller. When you created your project, you should have started with a "Single view project", which would have created a view controller for you. In that case, you would have been able to see your label.

查看更多
登录 后发表回答