TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

SOLVED: Day 58 Part 1

Forums > 100 Days of SwiftUI

When I run the app, after pressing the Add Example button, the app crashes with:

Thread 1: "An NSManagedObject of class 'Ship' must have a valid NSEntityDescription."

I initially after Day 57, deleted the wizard entity and the and the other one as each of the lessons seemed to have you create a new entity (even though there one was already). So i thought ok, something is correct, I did a clean build folder... that didnt help...deleted the app on the simulator, that didnt help... closed Xcode and the simulator and that didnt help. So I deleted the entire CoreDataProjectApp and made a new one...

I still have the issue....

I also made sure the NSPersistentContainer name matches the name of my CoreDataProject.xcdatamodeid

what am I missing?

import CoreData
import Foundation

class DataController: ObservableObject {
  let container = NSPersistentContainer(name: "CoreDataProject")

  init() {
      container.loadPersistentStores { description, error in
          if let error = error {
              print("Core Data failed to load: \(error.localizedDescription)")
          }
      }
  }
}

2      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.