Learn Courses My Dashboard

EXC_BAD_INSTRUCTION error in "ToDo" App

Hello,

I tested out the “ToDo” App’s MVP v1 file that was recently uploaded to the “How to Build an App” course materials and when I run the simulator, go to the PlannerView, add a task, and then try to swipe left to delete it, the program crashes and I get a “Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)” error message popping up in the “three_things_todoApp.swift” file.

Does this happen to you as well when attempting to delete a task in the PlannerView? What might be causing this?

Thanks!

Just looked at the code and the issue is here in the PlannerView:

Comment out that do catch block and the problem is solved.

Core Data still saves the change without that block.

Perfect, that did the trick. Thank you!