Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Introduction to Core Data Inserting and Saving Data Using a Context Inserting Data

Vladimir Pertsov
Vladimir Pertsov
6,809 Points

Problem with managedObjectContext

Could you help me please

In this video you declare "let managedObjectContext = CoreDataStack().managedObjectContext" in the begining of the calss AddTaskController

but in the final version of the App we had a

"var managedObjectContext: NSManagedObjectContext!"

I'm little lost there we change this line.

I'm trying to implement this code in my application but i get an error "Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value"

On this line print (“AddListControlles Context: (managedObjectContext.description)“)

So the point is that it can't find managedObjectContext, but if i change it back "let managedObjectContext = CoreDataStack().managedObjectContext" it's work but i had other troubles.

I will be really appreciate your help to solve this issue

PS you courses is awesome, thank you for it.