Group Group Group Group Group Group Group Group Group

Beginning Core Data · Managed Objects | Ray Wenderlich

This is a companion discussion topic for the original entry at

I downloaded the files and went through the tutorial and when I tried to simulate it, it failed, then I opened the “After” folder and tried running it, added some contacts, closed the app, relaunched it and got the following error:

Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: 'Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (5) must be equal to the number of items contained in that section before the update (0), plus or minus the number of items inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out).'

Your best bet is to stay with the same project throughout the course. For this problem, you’ll need to do a reset. Reset the simulator and start going through the tutorial again.

It’s hard to follow when you just write code and don’t explain it.

@anon16515425 Please let us know what you don’t understand exactly when you get a chance. Thank you!

I’m getting the following error when I run the code on XCode 11.4.1

<NSPersistentStoreDescription: 0x6000024d5c20> (type: SQLite, url: file:///Users/khuffie/Library/Developer/CoreSimulator/Devices/0604A892-B117-4CC8-9DF9-2180053320D9/data/Containers/Data/Application/609AFDB4-B212-4BF6-9464-B05A9234FBBE/Library/Application%20Support/PetPal.sqlite)

It’s not error
you just print storeDescription in your AppDelegate

For anyone maybe confused with the lazy var persistentContainer and saveContext, This block of code is normally supplied when new projects are created with “use core data” checked. I don’t think most people memorize this code. you can then use these in your view controllers once you assign the delegate to them.

Could you please explain what you are writing, everything happens so fast, most of us are just starting out and is really hard to follow what you are writing there. Writing fast and not explaining that it makes difficult to understand the whole concept, I’m super confused on what actually doing and I’m struggling to understand.

He is just writing code really fast(the video is speeded up) which is not really helpful to understand this I’m struggling here as well i know that this is challenging but just speeding up the whole part it’s not going to help anyone who is starting out because most of us don’t have any coding background.

@emrod22 Thank you for the heads up - much appreciated!

1 Like

@george30 There is a newer version of the course that was just published this week:

I hope it helps!

1 Like

Thanks a lot for this, the instructor is good but I feel like some of the things are way to fast as I’m doing this learning patH.

lazy var persistentContainer: NSPersistentContainer = {

let container = NSPersistentContainer(name: “Reminders”) This is still very confusing why we give the name of our data model to “NSPersistentContainer”? it might be me but the whole idea is very confusing. could you guys give a more clear explanation of this please?

@george30 Do you still have issues with this?