I’m getting this error in Chapter 17 of iOS Apprentice 8.3.0. On page 427, it suggests that I can run the app and add items under a checklist. I’m able to add a new checklist, but I get the above error when I click on the “+” for the new checklist item. I suspect that I haven’t initialized some variable so that it isn’t a nil. What I’m really asking here is “how do I debug this?”.
Addendum: The line that blew up was in ItemDetailViewController viewWillAppear:
override func viewWillAppear(_ animated: Bool) {
print("ItemDetailViewController viewWillAppear ")
super.viewWillAppear(animated)
textField.becomeFirstResponder() <— stopped on this line
}
Try commenting out //, the line in your code textField.becomeFirstResponder() and see what error comes up next. Maybe textField doesn’t exist or isn’t linked to the storyboard…
One of your objects being unwrapped with ! can’t be unwrapped because + didn’t add it. Compare your code with the sample code folder and see how RW did it.
Hi @steveb_la, were you able to resolve this issue? @doyle made a few good points. Generally when you receive the fatal error of finding nil with an optional value it is most likely because somewhere in your code you’re saying that your optional definitely has a value. However, with this error it seems unlikely that it does. The goal would be to pinpoint which optional is causing you trouble and safely unwrapping it to prevent the error.