|
Hello, In the last part of Project 12, part 1 I have this kind of erro when i try to ad the name of the wizard. An NSManagedObject of class 'Wizard' must have a valid NSEntityDescription. some one can help me to resolve it? Thanks |
|
|
|
Have you created your NSManagedObject subclasses via Xcode? From my understanding in this chapter you don't rely on code generation from Xcode but you have to create your own classes? https://www.hackingwithswift.com/books/ios-swiftui/creating-nsmanagedobject-subclasses |
![]() SAVE 50% To celebrate Black Friday, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more. Sponsor Hacking with Swift and reach the world's largest Swift community! |
|
yes I have done!
|
|
I think this i s teh correct subcalss |
|
When you want to add a Wizard you need a class Wizard, not Movie. That's what the error message is saying. |
|
I have redone the procedure for but the error is the same!
|
|
In your data model for Core Data is an option which is called Code Generation. Is it set to manual? Additionally, clean your build folder in Xcode. There is an option in the menu. I don't know the keyboard shortcut. |
|
I find The error. I forgot to put thi in the main file of swift
and
Thankyou for your Help! |
|
hey there, i had been trying, but what does "in the main file of swift" mean ? do you mean by DataController.swift ? |
|
Update! XCode 14.2 if you were like me consistently facing the same issue and tried out stack overflow method and failed here is update to please check out this solution from Paul https://www.hackingwithswift.com/quick-start/swiftui/how-to-configure-core-data-to-work-with-swiftui Took me 2 days to find out the solution! change "Main" to your "FileName" of .xcdatamodeld and also please add back the
Here below is all the code inside PersistenceController.swift
then YourProjectApp
|
|
I had this same problem but neither of the comments above helped. The solution for me was to update the CoreDataProjectApp.swift file and add
into the CoreDataProjectApp struct and give ContentView the modifier
|
SAVE 50% To celebrate Black Friday, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.