如何调试信号SIGABRT
问题描述:
我一直在学习Swift一段时间,信号SIGABRT发生了几次随机。我在网上尝试了一些教程,但它似乎并不一直工作。如何调试信号SIGABRT
这次我试图用两个视图控制器设置待办事项列表。一个有tableview,另一个有一个文本框来添加新的项目。以下是两者的代码行。希望有人能帮我解决这个难题。
import UIKit
var toDoList = [String]()
class FirstViewController: UIViewController,UITableViewDelegate {
@IBOutlet var toDoListTable: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
return toDoList.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
cell.textLabel?.text = toDoList[indexPath.row]
return cell
}
}
import UIKit
class SecondViewController: UIViewController {
@IBOutlet var newItem: UITextField!
@IBAction func addItem(sender: AnyObject) {
toDoList.append(newItem.text)
newItem.text = ""
}
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.
}
}
答
我收到这个错误,当我意外地重新命名的出口,而无需更新的连接。你有可能犯了这个错误吗?