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

Can't get the random fact app to run

On the third line where it says "class AppDelegate: UIResponder, UIApplicationDelegate {" I get an error message that says "Thread 1: signal SIGABRT"

import UIKit

@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    return true
}

func applicationWillResignActive(_ application: UIApplication) {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

could you copy the full error message and past it here?

2017-03-07 12:22:19.388 Fun Facts[1267:113232] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Fun_Facts.ViewController 0x7f9a09e03210> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key kill.' *** First throw call stack: ( 0 CoreFoundation 0x0000000104312d4b exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010149121e objc_exception_throw + 48 2 CoreFoundation 0x0000000104312c99 -[NSException raise] + 9 3 Foundation 0x0000000100f9f9df -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291 4 UIKit 0x0000000101bc8293 -[UIViewController setValue:forKey:] + 88 5 UIKit 0x0000000101e3c79e -[UIRuntimeOutletConnection connect] + 109 6 CoreFoundation 0x00000001042b79e0 -[NSArray makeObjectsPerformSelector:] + 256 7 UIKit 0x0000000101e3b122 -[UINib instantiateWithOwner:options:] + 1867 8 UIKit 0x0000000101bce9c5 -[UIViewController _loadViewFromNibNamed:bundle:] + 386 9 UIKit 0x0000000101bcf2e7 -[UIViewController loadView] + 177 10 UIKit 0x0000000101bcf61c -[UIViewController loadViewIfRequired] + 201 11 UIKit 0x0000000101bcfe70 -[UIViewController view] + 27 12 UIKit 0x0000000101a994b5 -[UIWindow addRootViewControllerViewIfPossible] + 71 13 UIKit 0x0000000101a99c06 -[UIWindow _setHidden:forced:] + 293 14 UIKit 0x0000000101aad519 -[UIWindow makeKeyAndVisible] + 42 15 UIKit 0x0000000101a25f8d -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4818 16 UIKit 0x0000000101a2c0ed -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731 17 UIKit 0x0000000101a2926d -[UIApplication workspaceDidEndTransaction:] + 188 18 FrontBoardServices 0x000000010b53c6cb __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24 19 FrontBoardServices 0x000000010b53c544 -[FBSSerialQueue performNext] + 189 20 FrontBoardServices 0x000000010b53c8cd -[FBSSerialQueue _performNextFromRunLoopSource] + 45 21 CoreFoundation 0x00000001042b7761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ + 17 22 CoreFoundation 0x000000010429c98c __CFRunLoopDoSources0 + 556 23 CoreFoundation 0x000000010429be76 __CFRunLoopRun + 918 24 CoreFoundation 0x000000010429b884 CFRunLoopRunSpecific + 420 25 UIKit 0x0000000101a27aea -[UIApplication _run] + 434 26 UIKit 0x0000000101a2dc68 UIApplicationMain + 159 27 Fun Facts 0x0000000100eaff2f main + 111 28 libdyld.dylib 0x00000001052c268d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

1 Answer

Make sure to name your View controller in storyboard, with the same name as the View Controller in your code. For example, if in your code you named the view controller as 'FunFactsViewController', go to storyboard then identity inspector then in the field where it says 'class' type the class name 'FunFactsViewController.

If you still can't solve the error, try to upload your project past the link here so I can take a look at it.