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

Andrew Bauml
Andrew Bauml
2,181 Points

When trying to connect a button within Swift for the first time, I keep on getting errors. Can you help please?

I noticed that theres two view controllers, is it supposed to be like that? How can I delete a view controller? The errors I get are:ld: 2 duplicate symbols for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) file:///Users/AJB2015/Desktop/FunFacts/FunFacts/Base.lproj/Main.storyboard: warning: Unsupported Configuration: Scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier:.

Also instead of having beautiful code with a class for ViewContoller, this is the code powering this so far:

import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

  • (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. }

  • (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }

  • (IBAction)showFunFact { println("You Touched Me!"); }

@end

Thank you for any help, I'm really excited to get past this and continue.

1 Answer

Chuck Toussieng
Chuck Toussieng
1,214 Points

The glaring thing I see is that your code is Objective-C mixed with Swift. I would delete your project (if you're just starting) and make a fresh one, making sure you selected Swift as the language.

THEN we can work on the buttons :)