Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6539375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:51:07+00:00 2026-05-25T10:51:07+00:00

While working on a project I ran into the following Issue, in my CoreData

  • 0

While working on a project I ran into the following Issue, in my CoreData model I had an entity called Object, this worked fine in the simulator (with a warning), but not on an actual iOS device. SO I had to change the name of the Entity. First I tried just changing the name of the Object in my model, and generate a new NSManagedObject subclass based on that.

This gave me all sorts of errors so I decided to remove the entity en create an entirely new one. This object I called REObject (Real Estate Object), I generated a new subclass again, based on the new entity, en changed all my code to use REObject instead of object. I also cleaned my project, and deleted the app from my testing device, yet still I get errors, currently this is the one I cannot fix.

Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘executeFetchRequest:error: A fetch request must have an entity.’

I use the following code to remove all the objects in case of receiving new Data and it throws the error when I execute the fetch:

- (void) deleteAllEntitiesOfType: (NSString *) entityType
{
    NSManagedObjectContext *context = [(Achmea_CatalogusAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];

    NSFetchRequest * all = [[NSFetchRequest alloc] init];
    [all setEntity:[NSEntityDescription entityForName:entityType inManagedObjectContext:context]];
    [all setIncludesPropertyValues:NO]; //only fetch the managedObjectID

    NSError * error = nil;
    NSArray * objects = [context executeFetchRequest:all error:&error];
    [all release];
    //error handling goes here
    for (NSManagedObject * o in objects) {
        [context deleteObject:o];
    }

    [context save:&error];

}

This method was working fine before I changed the object name but now it keeps giving me this error.

Edit: It feels like the app/project does not see the changes I made to the datamodel.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:51:08+00:00Added an answer on May 25, 2026 at 10:51 am

    This:

    [NSEntityDescription entityForName:entityType inManagedObjectContext:context]
    

    …is not returning a usable entity description for what ever reason.

    I would suggest breaking that call out to it’s own line and logging the return to see what your actually getting back.

    All it takes is one typo anywhere from the data model to the method call to create this problem.

    In the future, avoid names like object and entity. Objective-C has a global open name space so names like that can trigger naming collisions. Long, verbose names are the safest and , long term, easier to read.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've ran into a really weird problem while working on a large project. I
While working on an existing project I suddenly got the following error when trying
So I have been working on this project for a short while now. I
So I ran into a problem today while working on my Android program. I
While working on a school project, I wrote the following code: FileOutputStream fos; ObjectOutputStream
While working a project tonight, I ended up using one .js resource file for
While working on a project, I came across a JS-script created by a former
While working on a C++ project, I was looking for a third party library
While working on an Xcode project i keep getting the spinning wheel while switching
While I was working on an University project, I used a project-internal profiler made

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.