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 2.0 Deploying to a Device Recap: Deploying to Device

Stimulator doesn't work

I have been able to activate the stimulator, but when I now got to the section "Build a Simple iPhone App", "Deploying to a Device", "Running on a Device", my stimulator no longer works! I am not sure what is going on, I have not changed anything, it worked before, but not now. The code error is saying "Invalid redeclaration of view controller" (2), but I already had this in previous videos. How do I get this stimulator up and running so I can go ahead and deploy it on my device? Here are two screen shots I got:

/Users/mattconway/Desktop/Screen Shot 2016-02-07 at 2.24.26 PM.png

/Users/mattconway/Desktop/Screen Shot 2016-02-07 at 2.23.30 PM.png

8 Answers

Hi Matt,

Did you get this working?


Nope doesn't work. I am trying to copy the screenshots to this, but it is not working. How do I put screenshots from desktop to this discussion? It does not always work.

I always struggle with screenshots. I can't get them to work as the Markdown says they should.

I save my screenshots files into Google drive or Dropbox and copy the links into here directly. That works.

When I save a screenshot on my iMac, I use Command+Shift+3, and it saves to my desktop automatically. So how do you save it to Google drive (I have Safari), and I am not sure which Dropbox you are talking about. Let me know how you copy them into these. Thanks!

Yeah, I have a Mac too. I prefer the Cmd + Shift + 4 to select an area, but that's the same thing.

Dropbox is an application that gives you free storage space; so is Google Drive. You could use Pinterest or Imgur or anything that hosts your pic; you just need a link to your pic so get them uploaded somewhere shareable. Facebook might work, or Twitter. I'm @OnlySteveH

Or look me up in my profile here; there's lots of ways of getting info to me.


I now have Google Drive and copied the 4 screenshots. However, I am not able to send it to you. I don't have a Twitter or Facebook account, but I use mostly email. How do I send these screenshots to you? Cant seem to make a link

Google drive allows you to share a link. You can post that link in here. Else, my profile has my company website link in it and my email address is on there.

Hi Matt,

Before we worry about the simulator working, or otherwise, we need to get your code operating.

In your first screen shot, here, you have an error in the code. At the top of the code window, you have declared a ViewController class. At the bottom of the window, you have done the same - that's causing a conflict.

I don't know if you can just delete the second one - It is n't clear how many more lines are involved. You have declared a blueColor constant in there; I don't know where that is used; I can't see that it is in the visible code, so you may just be able to delete it.

This error may be causing the issue with your simulator; it certainly will prevent your code from running so let's get this out of the way first, then we can worry about any other issues that are present.

If the code ends pretty much where the visible code runs out, comment out the second ViewController class - every line - and try to run the code again. I don't think you need blueColor at this stage, but we shall see. Let's get rid of the duplicate class; that's what's causing your "invalid redeclaration error" and probably all the other symptoms too.

Let me know how you get on.


Hi Steve, sorry for delay. I pretty much figured out the error codes, and fixed it, however, there are some missing codes, so stimulator doesn't completely work. Also, I had to reinstall Xcode (twice), there was probably some damaged files preventing the stimulator from running. So I'll be starting over and start from scratch all 5 sections of the "Build A Simple iPhone App with Swift 2.0" this week. Any problems, I'll let you know! Thanks.

Cool. Glad you fixed it. One thing: it's a simulator. A stimulator is a very different thing. :wink:

Just saying. :+1: