【发布时间】:2014-06-13 18:42:06
【问题描述】:
当我尝试使用下面的代码从表视图中删除一行时,我不断收到Thread 1: signal SIGABRT 错误。我正在使用 Swift(不知道该怎么做)并且正在构建一个基于表格视图的应用程序。我一整天都在尝试删除一行,但我却一无所获。这应该是简单的任务,但 Swift 让我无法做到。
// Override to support editing the table view.
override func tableView(tableView: UITableView?, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath?) {
if editingStyle == .Delete {
if let tv = tableView {
if let ip = indexPath {
tv.deleteRowsAtIndexPaths([ip], withRowAnimation: UITableViewRowAnimation.Fade)
}
}
// Delete the row from the data source
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
错误似乎与AppDelegate文件有关:
【问题讨论】:
-
控制台告诉你什么?
-
@jsksma2 我不明白它告诉我的一半内容,但以 libc++abi.dylib: terminating with uncaught exception of type NSException 这行结尾
-
对,
NSException通常包含一条消息。尝试运行足够深的终止,使其吐出消息。
标签: ios xcode uitableview swift