Group Group Group Group Group Group Group Group Group

Chapter 9 Final Project Crash

After clicking save button, the program will crash and stop at

public func createQuestionGroupViewController(
viewController: CreateQuestionGroupViewController,
created questionGroup: QuestionGroup) {

questionGroupCaretaker.questionGroups.append(questionGroup)
try? questionGroupCaretaker.save()

dismiss(animated: true , completion: nil)
tableView.reloadData() <- Program stops here when crash
}

The final project in the version 2.0 won’t crash.

I guess maybe it’s because the observer pattern’s problem? That is the only difference in SelectQuestionGroupViewController.

Can anybody help me to find out why it crashes?

@lmw41 Thanks very much for your question.

Have you put break points in this function? If so, at what line does it crash? What is the error message displayed in the console?