Core Data - Fetch Error

This question is not related to any of the lessons.

I am trying to use Core Data with my App and to get a handle on using Core Data I have a sample app that I found which is straight forward and as far as I can tell should work with my app.

When I set everything up in my app I get a Fetch error: “A fetch request must have an entity”
The sample app I’m working with does not require this.

The Fetch code for the sample app looks like this:
@FetchRequest(sortDescriptors: [SortDescriptor(.date, order: .reverse)]) var food: FetchedResults

My Fetch code looks like this:
@FetchRequest(sortDescriptors: [SortDescriptor(.userID, order: .reverse)]) var settings: FetchedResults

Both apps are set to run with IOS 15.2 or above.

Can someone please tell me why the heck I’m having this problem?
This is really frustrating.
I have a couple of other questions, but at the moment this is the most critical as it is crashing my app.

Any help would be GREATLY appreciated.


Hi Ed,

It might be helpful if you could share your project either by compressing it into a zip file and post on either Dropbox or Google Drive and then create a share link and post that link in a reply. Alternatively place the project on GitHub from where we can download and have a look in order to make suggestions on what to do.

Thanks Chris. I will do so.