【发布时间】:2014-10-03 22:59:28
【问题描述】:
我有一个运行良好的 UITableView。当我在 viewDidLoad() 方法中使用以下代码启用编辑模式时:
self.tableView.editing = true
我收到以下错误:
fatal error: unexpectedly found nil while unwrapping an Optional value
在这一行:
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return fetchedResultsController.sections!.count // error here
}
我检查并 fetchedResultsController 不是 nil,但 section 是。
如果编辑模式被禁用,则不是这种情况。
可能是什么原因?
【问题讨论】:
标签: objective-c uitableview swift ios8