WWDC24 SALE: Save 50% on all my Swift books and bundles! >>

Solved Day 58 - problems adding a new entity to core data

Forums > 100 Days of SwiftUI

@CJ  

I am trying to work through the Core Data technical project (days 57-59) but have got very confused by the jumping from on thing to another and am wondering if I missing soemthing as I am getting error messages each time the entity is changed. In the tutorial Paul keeps adding different entities but when I add more than one to core data it doesn't recognise the new one and when I write out the fetch request it says 'not found in scope'. I have tried forcing save but I am wondering if you can't actually have two entities in the same core data model or if you have to change something elsewhere. I already had to create a second project after he changed the 'movie' entity to 'wizard' as I could not get that to work at all. Are we supposed to create a new project for each entity or delete the old one? He doesn't mention that we do but clearly I am doing something wrong as it is not working. If anyone could shed any light here, it would be appreciated.

Thanks

2      

At times xcode cannot recognize it immediately, but after rebuild (cmd + B) it starts recognizing.

2      

@CJ  

Thanks for your reply - I have tried but when I press command + b, it says 'failed to build.' I get an error message also in the CoreDataProjectApp file saying 'Generic parameter 'Content' could not be inferred.' As far as I can see, I have done everthing he has and it worked okay for the Wizard entity but this new entity will not be recognised for some reason.

2      

@Bnerd  

CMD+S to save the CoreData, CMD+shift+K to clean, then CMD+B to build.

2      

@CJ  

Many thanks @Bnerd - it is now working!

2      

Save 50% in my WWDC sale.

SAVE 50% To celebrate WWDC24, 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.

Save 50% on all our books and bundles!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.