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

Thread 1: signal SIGABRT

I often got this Thread 1: signal SIGABRT error when i execute code. here is my code :

import UIKit

class ViewController: UIViewController {

//all the conections


//@IBOutlet weak var errorOutput: UILabel!
@IBOutlet weak var errorOutput: UILabel!
@IBOutlet weak var result: UILabel!
@IBOutlet weak var instructions: UILabel!
@IBOutlet weak var year: UITextField!

//other stuff var watis = false

//the errors
enum error: Error {
    case noInput(description: String)
    case ThecnicalDifficulties(description: String)
}
override func viewDidLoad() {
    super.viewDidLoad()



}



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


@IBAction func GoButton(_ sender: Any) {
Cauculator()
}
//Int(input1.text!)!
func Cauculator () {

func animalResults () -> String {

    if Int(year.text!)! % 12 == 0 {
        return "Monkey"
    } else if Int(year.text!)! % 12 == 1 {
        return "Rooster"

    }else if Int(year.text!)! % 12 == 2 {
        return "Dog"
    } else if Int(year.text!)! % 12 == 3 {
        return "Pig"
    }else if Int(year.text!)! % 12 == 4 {
        return "Rat"
    }else if Int(year.text!)! % 12 == 5 {
        return "Ox"
    }else if Int(year.text!)! % 12 == 6 {
        return "Tiger"
    }else if Int(year.text!)! % 12 == 7 {
        return "Rabbit"
    }else if Int(year.text!)! % 12 == 8 {
        return "Dragon"
    }else if Int(year.text!)! % 12 == 9 {
        return "Snake"
    }else if Int(year.text!)! % 12 == 10 {
        return "Horse"
    }else {return "Sheep"}

}

self.result.text = animalResults()
}

}

and here is the council

018-01-27 12:50:57.026515-0800 chinese dragon[1939:41711] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<chinese_dragon.ViewController 0x7f965af0a8d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key results.' *** First throw call stack: ( 0 CoreFoundation 0x000000011224a12b exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010e53ff41 objc_exception_throw + 48 2 CoreFoundation 0x000000011224a079 -[NSException raise] + 9 3 Foundation 0x000000010df5ea63 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292 4 UIKit 0x000000010ef7c117 -[UIViewController setValue:forKey:] + 87 5 UIKit 0x000000010f26dc2d -[UIRuntimeOutletConnection connect] + 109 6 CoreFoundation 0x00000001121ed3cd -[NSArray makeObjectsPerformSelector:] + 317 7 UIKit 0x000000010f26c5e3 -[UINib instantiateWithOwner:options:] + 1856 8 UIKit 0x000000010ef833ff -[UIViewController _loadViewFromNibNamed:bundle:] + 383 9 UIKit 0x000000010ef83d2b -[UIViewController loadView] + 177 10 UIKit 0x000000010ef8405c -[UIViewController loadViewIfRequired] + 195 11 UIKit 0x000000010ef848b9 -[UIViewController view] + 27 12 UIKit 0x000000010ee4f7cf -[UIWindow addRootViewControllerViewIfPossible] + 122 13 UIKit 0x000000010ee4fed7 -[UIWindow _setHidden:forced:] + 294 14 UIKit 0x000000010ee62e54 -[UIWindow makeKeyAndVisible] + 42 15 UIKit 0x000000010edd58b8 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4737 16 UIKit 0x000000010eddaaeb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720 17 UIKit 0x000000010f1a46f8 __111-[UICanvasLifecycleMonitor_Compatability scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924 18 UIKit 0x000000010f57a4c8 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 19 UIKit 0x000000010f1a42f1 -[UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249 20 UIKit 0x000000010f1a4b6b -[UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 696 21 UIKit 0x000000010fb22a69 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262 22 UIKit 0x000000010fb22922 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444 23 UIKit 0x000000010f7ff9c8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221 24 UIKit 0x000000010f9feb06 _performActionsWithDelayForTransitionContext + 100 25 UIKit 0x000000010f7ff88b -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231 26 UIKit 0x000000010f579b25 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392 27 UIKit 0x000000010edd936a -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523 28 UIKit 0x000000010f3b4605 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369 29 FrontBoardServices 0x0000000114101cc0 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338 30 FrontBoardServices 0x000000011410a7b5 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235 31 libdispatch.dylib 0x000000011336533d _dispatch_client_callout + 8 32 libdispatch.dylib 0x000000011336a9f3 _dispatch_block_invoke_direct + 592 33 FrontBoardServices 0x0000000114136498 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK_ + 24 34 FrontBoardServices 0x000000011413614e -[FBSSerialQueue performNext] + 464 35 FrontBoardServices 0x00000001141366bd -[FBSSerialQueue _performNextFromRunLoopSource] + 45 36 CoreFoundation 0x00000001121ed101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ + 17 37 CoreFoundation 0x000000011228cf71 __CFRunLoopDoSource0 + 81 38 CoreFoundation 0x00000001121d1a19 __CFRunLoopDoSources0 + 185 39 CoreFoundation 0x00000001121d0fff __CFRunLoopRun + 1279 40 CoreFoundation 0x00000001121d0889 CFRunLoopRunSpecific + 409 41 GraphicsServices 0x00000001149ca9c6 GSEventRunModal + 62 42 UIKit 0x000000010eddc5d6 UIApplicationMain + 159 43 chinese dragon 0x000000010dc277f7 main + 55 44 libdyld.dylib 0x00000001133e1d81 start + 1 45 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

please help

2 Answers

Jeff McDivitt
Jeff McDivitt
23,970 Points

Did you delete anything out of your project. This typically happens when there is not a correct connection. Check all of you outlets and make sure that they have a connection

I checked them all i even deleted them all, and then reconnected them

Jeff McDivitt
Jeff McDivitt
23,970 Points

IF you put the code on GitHub I can take a look :)