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 Views and View Controllers View Controllers and IBAction

M S
M S
224 Points

When I try to run the simulator, my simulator turns black. What is happening and how do I fix it?

Someone please help me

Kevin Hamil
Kevin Hamil
8,203 Points

You should be as specific as you can about the issue you're having and post your code to help us help you. Without seeing what is happening in your code, it's hard to guess what it could be.

M S
M S
224 Points

-OK. Well, when I try to run it, Xcode switches to a file that says AppDelagate.swift. It has a line of code that is highlighted, so I'm guessing that that is the error. The line of code says:


class AppDelegate: UIResponder, UIApplicationDelegate {


-Next to it, there is a warning that says:


Thread 1: signal SIGABRT


-FYI, i put in the lines t separate what Xcode says and what I'm saying. I also put dashes where I'm speaking just so you don"t get confused.

3 Answers

Copy and paste your code here so we can help if you haven't still figured it out.

M S
M S
224 Points

ok, so this is what is says:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    return true
}

What should I delete? I tried deleting:

-> Bool { // Override point for customization after application launch. return true }

I got a message saying:

"Expected '{' in body of function declaration."

Do you know what to do?

That block of code is fine. Don't delete anything. I'd also suggest going through the Swift courses to see what that "-> Bool" means and why that method is returning 'true'.

Are you working with a Storyboard? If so, go to your General settings tab and scroll down to where it says "Main Interface". Click on the down arrow and choose the view controller that serves as your Main view controller in your project. See if that works.

Are you running the app with a Storyboard? If so, go to the appDelegate and make sure there is nothing in the "didFinishLaunchingWithOptions" method. There may be some boilerplate code that creates a window, sets its background color and makes it visible. Erase that and run the app again.

M S
M S
224 Points

Um, I think that I am running the app with View Contoller. Should I still check or is there a different option?

M S
M S
224 Points

When I delete some thing that says

-> Bool { //overide point for customization after application launch. return true } | Next, I get an eror message that points to the "a" in the "func application(application..." the a is the one with the line over it. The error says, "Expected '{' in body of function declaration."

Do you know what to do?

same problem was happening with me i deleted the button and erased the code then added a new button and re linked it then started working properly