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

Steven Cruz
Steven Cruz
1,795 Points

Weird Output and can't press more than once

I copied exactly what Pasan did and I get this crazy output. Any help?

You pressed me. 2014-12-09 14:25:37.657 FunFacts[5262:309050] -[FunFacts.ViewController showFunFact:]: unrecognized selector sent to instance 0x7a6cb1b0 2014-12-09 14:25:37.687 FunFacts[5262:309050] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FunFacts.ViewController showFunFact:]: unrecognized selector sent to instance 0x7a6cb1b0' *** First throw call stack: ( 0 CoreFoundation 0x0021d946 exceptionPreprocess + 182 1 libobjc.A.dylib 0x01bf9a97 objc_exception_throw + 44 2 CoreFoundation 0x002255c5 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277 3 CoreFoundation 0x0016e3e7 ___forwarding_ + 1047 4 CoreFoundation 0x0016dfae CF_forwarding_prep_0 + 14 5 libobjc.A.dylib 0x01c0f7cd -[NSObject performSelector:withObject:withObject:] + 84 6 UIKit 0x00a3223d -[UIApplication sendAction:to:from:forEvent:] + 99 7 UIKit 0x00a321cf -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64 8 UIKit 0x00b65e86 -[UIControl sendAction:to:forEvent:] + 69 9 UIKit 0x00b662a3 -[UIControl _sendActionsForEvents:withEvent:] + 598 10 UIKit 0x00b6550d -[UIControl touchesEnded:withEvent:] + 660 11 UIKit 0x00a8260a -[UIWindow _sendTouchesForEvent:] + 874 12 UIKit 0x00a830e5 -[UIWindow sendEvent:] + 791 13 UIKit 0x00a48549 -[UIApplication sendEvent:] + 242 14 UIKit 0x00a5837e _UIApplicationHandleEventFromQueueEvent + 20690 15 UIKit 0x00a2cb19 _UIApplicationHandleEventQueue + 2206 16 CoreFoundation 0x001411df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ + 15 17 CoreFoundation 0x00136ced __CFRunLoopDoSources0 + 253 18 CoreFoundation 0x00136248 __CFRunLoopRun + 952 19 CoreFoundation 0x00135bcb CFRunLoopRunSpecific + 443 20 CoreFoundation 0x001359fb CFRunLoopRunInMode + 123 21 GraphicsServices 0x03fb124f GSEventRunModal + 192 22 GraphicsServices 0x03fb108c GSEventRun + 104 23 UIKit 0x00a308b6 UIApplicationMain + 1526 24 FunFacts 0x0003a3ce top_level_code + 78 25 FunFacts 0x0003a40b main + 43 26 libdyld.dylib 0x02366ac9 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

Stone Preston
Stone Preston
42,016 Points

can you post your code please

Steven Cruz
Steven Cruz
1,795 Points

Here's my code:

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func showFunFact() {
        println("You pressed me.")
    }

   }

It directs me to AppDelegate.swift where

class AppDelegate: UIResponder, UIApplicationDelegate { has Thread 1: signal SIGABRT

2 Answers

Stone Preston
Stone Preston
42,016 Points

remove the current IBAction and try connecting it to your button one more time. you may have to go into the outlets inspector in the utilites pane and remove the old outlet connection, but try just deleting the following first, and then reconnecting the action:

@IBAction func showFunFact() {
        println("You pressed me.")
    }

delete that, and reconnect the button action and try running it again

I was getting folliwng error...

libc++abi.dylib: terminating with uncaught exception of type NSException

Problem was i created an action and renamed,

Solution: http://stackoverflow.com/questions/26442414/libcabi-dylib-terminating-with-uncaught-exception-of-type-nsexception-lldb