After I compile the app after adding the ListDetailViewControllerDelegate on page 170, the app crashes when I try to add a new item to the Checklists page.
The error I get is on the ListDetailViewController.swift page and in this method:
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string:String) -> Bool {
let oldText = textField.text! as NSString
let newText = oldText.replacingCharacters(in: range, with: string) as NSString
doneBarButton.isEnabled = (newText.length > 0)
return true
}
The specific line which causes the EXC_BAD_INSTRUCTION error is:
doneBarButton.isEnabled = (newText.length > 0)
The app compiles fine, but when I try to add an item in the Edit page, the app crashes with this error message. Have rebuilt the app twice, and this issue has come back both times.
In the variables window, there is this message:
doneBarButton = (UIBarButtonItem!)nil
I donโt understand how the doneBarButton can be nil?
Thanks in advance.