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 View Controllers and Views Using IBAction to Execute Methods

Clicking the button in the simulator throws an error.

I followed his steps exactly, but I get an error when I click the button we built in this video.

Here is what the error looks like. https://www.dropbox.com/s/8044m370jyoxfrz/Screenshot%202017-01-23%2022.28.59.png?dl=0

2 Answers

David Papandrew
David Papandrew
8,386 Points

That type of error usually indicates some sort of problematic outlet connection. If you are familiar with the storyboard editor in Xcode, go to the project's storyboard and then open the "document outline" and then on the document outline find the "View Controller" in the hierarchy. Right click and you'll see a popup panel that includes a section labeled "Outlets". It's possible you have a duplicate outlet listed there (maybe you only partially deleted an earlier outlet?). I can't know without seeing the output of this panel, but that is a good place to check first.

If you do see a duplicate or incomplete outlet, you can delete it by clicking on the "x" on this popup panel.

Good luck.

That was it. So deleting the @IBoutlet line of code does not actually delete the connection?

David Papandrew
David Papandrew
8,386 Points

Yeah, unfortunately you need to delete the code as well as the outlet connection in Interface Builder. A bit of a pain if you ask me, but at least now you know for the future. There are a few other situations like that in Xcode where you need to delete things in multiple places.