【发布时间】:2015-06-28 00:09:29
【问题描述】:
我的项目是一个带有导航栏和 segue 的简单应用程序,我收到此错误:
fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)
在行中:
cell.valueLabel.text = dictionary.word
线程 1:EXC_BREAKPOINT(代码=1,子代码=0x100239474
应用程序在 iphone 中运行第一个 tableview,但是当我触摸 table view 的任何一行以转到下一个 table view 时,应用程序崩溃。 如果我删除这个开关,segue 就可以工作,我可以看到第二个视图控制器
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! DefinitionTableViewCell
switch indexPath.row {
case 0:
cell.fieldLabel.text = "wordLabel"
cell.valueLabel.text = dictionary.word
case 1:
cell.fieldLabel.text = "meaningLabel"
cell.valueLabel.text = dictionary.meaning
default:
cell.fieldLabel.text = ""
cell.valueLabel.text = ""
}
return cell
}
任何帮助都非常受欢迎:)
【问题讨论】: