Black screen on iphone

If you get black screen when you run your iphone code, check if you do this:

@synthesize window = _window;

and then this:

[window makeKeyandVisible];

This, will not work. The @synthesize line is “new” in xcode 4, per objective c. it makes accessing windows directly FAIL and return nil. Thus, makeKeyAndVisible was never called on the window as you intended.

Thus, you should either do either one, or both, of the following:

@synthesize window;

and then:

[self.window makeKeyAndVisible];

Leave a Comment