Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App with Swift Improving Our User Interface Adding a Pop of Color

Screen goes black after adding StatusBarStyle to AppDelegate

I'm not sure what went wrong, everything ran properly until I ended up changing the info section to change/add the 'View controller-based status bar' bool to the info list, and then added the

application.setStatusBarStyle(UIStatusBarStyle.LightContent, animated: false)

snippet of code.

Any suggestions/ feedback would be taken kindly. Thank you!

5 Answers

Stone Preston
Stone Preston
42,016 Points

have you tried removing that line and verifying that it is indeed the one causing the issue

Yes, i've tried removing the line, yet I still have the issue. :'(

Stone Preston
Stone Preston
42,016 Points

alright set the view controller based status bar plist value back to what it was and then see if you still have the issue. If that doesnt work try restarting your simulator/xcode

do you see your app launch at all? like do you see the launch screen?

i

Antonio Cancio
Antonio Cancio
1,337 Points

I see the launch screen, but I am having the same issue. In the console I see:

```2014-12-21 21:05:00.369 FunFacts[2084:201494] -[UIButton setText:]: unrecognized selector sent to instance 0x7f83284525f0 2014-12-21 21:05:00.371 FunFacts[2084:201494] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setText:]: unrecognized selector sent to instance 0x7f83284525f0'

But I am not calling .text on a button, only a label.
Antonio Cancio
Antonio Cancio
1,337 Points

Just figured this out. I think there is a bug in xcode where if you created an outlet for funFactButton and accidentally named it funFactLabel (Which I did, and maybe others have), Xcode will think that funFactLabel is of type UIButton even after you change the name of the outlet to funFactButton.

The solution for me was to delete both outlets for funFactLabel and funFactButton and create them again by control-dragging from the label and button in the storyboard.

Anthony Rios
Anthony Rios
1,780 Points

I am having the same all black issue as you. Im not sure exactly what you are saying above. I deleted both outlets, commented out code that uses them and its still all black. I then tried deleting them and recreating them by the dragging method and it is still all black.

Antonio Cancio
Antonio Cancio
1,337 Points

If you go on to the video after this it actually talks about "orphaned outlets" and goes into detail on how to properly fix the issue. Have you gone on to the next video debugging?

Anthony Rios
Anthony Rios
1,780 Points

I did go to the next video but blazed through it just to find how to run with break points...i will check out the entire video and see if that helps.

Anthony Rios
Anthony Rios
1,780 Points

So the problem ended up being in the Fun Facts General tab. The deployment info section has a Main Interface drop down that was blank. I changed it to main and everything works. Im not sure how that got removed but at least its fixed.