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

My code is not working for Xcode. Did I do something?

I copied everything on a course in Swift 2.0: Build A Simple iPhone app, but when I ran the code on simulator, Xcode took me to AppDelegate.Swift.

One part was highlighted in red

class AppDelegate: UIResponder, UIApplicationDelegate {

It said: Thread 1: signal SIGABRT

What does this mean? I would really appreciate it if someone helps. Thanks.

Lana

2 Answers

could you post your code pls

My code:

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var funFactLabel: UILabel!
let facts = ["Ants stretch when they wake up in the morning", "Ostritchs can run faster than horses"]

override func viewDidLoad() {
    super.viewDidLoad()
    //Filled in circle indicates that the property is connected to an element in interface builder.
    funFactLabel.text = facts[0]
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}
@IBAction func showFunFact() {
funFactLabel.text = "Another interesting fact!"
    funFactLabel.text = facts[1]
}

}

// // AppDelegate.swift // FunFacts // // Created by Wong on 10/21/16. // Copyright © 2016 Wong. All rights reserved. //

import UIKit

@UIApplicationMain

class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> 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 throttle down OpenGL ES frame rates. 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.
}

func applicationWillEnterForeground(application: UIApplication) {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(application: UIApplication) {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

}

The part that is highlighted is:

class AppDelegate: UIResponder, UIApplicationDelegate {

It comments

Thread 1: breakpoint 1.3.

What does that even mean? This problem prevents the code to run through simulator.

Thank you so much for helping. I have been stuck with this problem for a few days.
I really appreciate it.

Lana

check in connections inspector, if all the @IB in the view controller are connected and only once to their pair's main story board.