Question: Thread 1: signal SIGABRT - What is the issue?

Question

Thread 1: signal SIGABRT - What is the issue?

Answers 0
Added at 2017-01-04 23:01
Tags
Question

I am a beginner in programming, and new to Stack Overflow as well. I'm still figuring out how codes and this website work, so I'm sorry if I didn't use them correctly. (I'm not a native English speaker, but I'll do my best to explain my question as well as possible)

So, I'm building a To Do List App for my school project, but it doesn't work well. I don't have any red caution marks, but when I run the simulator and click "add button", it stops running and goes back to codes files. There I see "Thread 1: signal SIGABRT" in AppDelegate.swift.

The message in the console is:

2017-01-06 20:14:30.057054 To-Do-List[61234:3241731] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/mikinatanaka/Library/Developer/CoreSimulator/Devices/27DCECFA-4E53-4C94-9985-2D4BBA9575CE/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles 2017-01-06 20:14:30.058241 To-Do-List[61234:3241731] [MC] Reading from private effective user settings. 2017-01-06 20:14:32.392577 To-Do-List[61234:3241836] 0x600000548cf0 Copy matching assets reply: XPC_TYPE_DICTIONARY { count = 1, transaction: 0, voucher = 0x0, contents = "Result" => : 29 } 2017-01-06 20:14:32.393567 To-Do-List[61234:3241836] 0x6080003406e0 Daemon configuration query reply: XPC_TYPE_DICTIONARY { count = 2, transaction: 0, voucher = 0x0, contents = "Dictionary" => { count = 1, transaction: 0, voucher = 0x0, contents = "ServerURL" => { count = 3, transaction: 0, voucher = 0x0, contents = "com.apple.CFURL.magic" => C3853DCC-9776-4114-B6C1-FD9F51944A6D "com.apple.CFURL.string" => { length = 30, contents = "https://mesu.apple.com/assets/" } "com.apple.CFURL.base" => : null-object } } "Result" => : 0 }

2017-01-06 20:14:32.394060 To-Do-List[61234:3241836] [MobileAssetError:29] Unable to copy asset information from https://mesu.apple.com/assets/ for asset type com.apple.MobileAsset.TextInput.SpellChecker
2017-01-06 20:14:37.185 To-Do-List[61234:3241731] -[To_Do_List.AddToDo addItemWithSender:]: unrecognized selector sent to instance 0x7fc5184025d0
2017-01-06 20:14:37.320 To-Do-List[61234:3241731] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[To_Do_List.AddToDo addItemWithSender:]: unrecognized selector sent to instance 0x7fc5184025d0'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000106ec234b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010692321e objc_exception_throw + 48
    2   CoreFoundation                      0x0000000106f31f34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x0000000106e47c15 ___forwarding___ + 1013
    4   CoreFoundation                      0x0000000106e47798 _CF_forwarding_prep_0 + 120
    5   UIKit                               0x00000001072e75b8 -[UIApplication sendAction:to:from:forEvent:] + 83
    6   UIKit                               0x000000010746cedd -[UIControl sendAction:to:forEvent:] + 67
    7   UIKit                               0x000000010746d1f6 -[UIControl _sendActionsForEvents:withEvent:] + 444
    8   UIKit                               0x000000010746c0f2 -[UIControl touchesEnded:withEvent:] + 668
    9   UIKit                               0x0000000107354ce1 -[UIWindow _sendTouchesForEvent:] + 2747
    10  UIKit                               0x00000001073563cf -[UIWindow sendEvent:] + 4011
    11  UIKit                               0x000000010730363f -[UIApplication sendEvent:] + 371
    12  UIKit                               0x0000000107af571d __dispatchPreprocessedEventFromEventQueue + 3248
    13  UIKit                               0x0000000107aee3c7 __handleEventQueue + 4879
    14  CoreFoundation                      0x0000000106e67311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    15  CoreFoundation                      0x0000000106e4c59c __CFRunLoopDoSources0 + 556
    16  CoreFoundation                      0x0000000106e4ba86 __CFRunLoopRun + 918
    17  CoreFoundation                      0x0000000106e4b494 CFRunLoopRunSpecific + 420
    18  GraphicsServices                    0x000000010b4c4a6f GSEventRunModal + 161
    19  UIKit                               0x00000001072e5964 UIApplicationMain + 159
    20  To-Do-List                          0x00000001063415df main + 111
    21  libdyld.dylib                       0x000000010a53c68d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

What does this error mean? and how can I fix it?

I know this is the elementary question, but I couldn't understand it although I read a number of articles.

In some of the articles, they say that the error occurs because of the bad connection in the View Controller. Is it right? I checked all the connections but I didn't see any connection errors.

Please give me some helps to fix the error! Thank you so much.


I'm using Xcode Version 8.1 and Swift 2.0. I copied and pasted codes below:

ViewController.swift

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var todolistTable: UITableView!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        func viewDidLoad() {
                if UserDefaults.standard.object(forKey: "todoList") != nil {
                todoItem = UserDefaults.standard.object(forKey: "todoList") as! [String]
            }
        }
    }

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

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return todoItem.count
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cellValue = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "cell")
        cellValue .textLabel?.text = todoItem[indexPath.row]
        return cellValue
    }

    func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath){
        if editingStyle == UITableViewCellEditingStyle.delete{
            todoItem.remove(at: indexPath.row)
            UserDefaults.standard.set(todoItem, forKey: "todoList")
            todolistTable.reloadData()
        }
    }

    override func viewDidAppear(_ animated: Bool) {
        todolistTable.reloadData()
    }


}

AddToDo.swift

import UIKit

var todoItem = [String]()

class AddToDo: UIViewController {

    @IBOutlet weak var itemText: UITextField!

    @IBAction func addItem(sender: AnyObject) {
        todoItem.append(itemText.text!)
        itemText.text = ""
        UserDefaults.standard.set(todoItem, forKey: "todoList")
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

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

    func textFieldShouldReturn(textField: UITextField!) -> Bool {
        itemText.resignFirstResponder()
        return true
    }


    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
Answers to

Thread 1: signal SIGABRT - What is the issue?

Source Show
◀ Wstecz