gpt4 book ai didi

ios - 删除 TableView 行会引发线程 1 : signal SIGABRT

转载 作者:行者123 更新时间:2023-11-28 11:23:45 25 4
gpt4 key购买 nike

当我尝试使用下面的代码从 TableView 中删除一行时,我不断收到 Thread 1: signal SIGABRT 错误。我正在使用 Swift(不知道该怎么做)并正在构建一个基于 TableView 的应用程序。我整天都在尝试删除一行,但我只是没有得到任何结果。这应该是一个简单的任务,但 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 文件有关:

enter image description here

最佳答案

您是否也在更新支持 TableView 的数据源?如果 tableView(numberOfRowsInSection) 方法不更改其返回值,它可能会导致问题。

关于ios - 删除 TableView 行会引发线程 1 : signal SIGABRT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24211961/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com