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 3439804
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:21:19+00:00 2026-05-18T08:21:19+00:00

Standard newbie question. I’ve created a data model for an iOS application. I am

  • 0

Standard newbie question. I’ve created a data model for an iOS application. I am able to create, update and delete entities within the model from various views by using the NSEntityDescription object.

Say if I had a mutable array of objects returned from a fetch request. How can I loop through each one when I do not have a generated object definition from the entity model? By generated object definition I mean, a header and body class definition of the entity described in the data model package.

  • 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-18T08:21:20+00:00Added an answer on May 18, 2026 at 8:21 am

    All CoreData entities derive from NSManagedObject and all the database data from those can be accessed via key value encoding. The minimum you need to know can be gained from the Model. You don’t necessarily require the headers.

    For example an entity PersonEntity which has a relationship to NameEntity with attribute firstname

    NSArray *results = [managedObjectContext queryEntityForName:@"PersonEntity" predicateFormat:nil argumentArray:nil];
    
    for(NSManagedObject *object in results)
    {
    NSString *name = [object valueForKeyPath:@"nameobject.firstname";
    [self doSomething:name];
    }
    

    queryEntityForName is my own category. You might find it useful.

    @implementation NSManagedObjectContext(VMQueryAdditions)
    
    -(NSArray *)queryEntityForName:(NSString *)name predicateFormat:(NSString *)pstring argumentArray:(NSArray *)arr
    {
        NSEntityDescription *entity = [NSEntityDescription entityForName:name inManagedObjectContext:self];
        NSFetchRequest *fetch = [[[NSFetchRequest alloc] init] autorelease];
    
        [fetch setEntity:entity];
        NSPredicate *pred;
    
        if(pstring)
        {
            if(arr) pred = [NSPredicate predicateWithFormat:pstring argumentArray:arr];
            else    pred = [NSPredicate predicateWithFormat:pstring];
            [fetch setPredicate:pred];
        }
    
        NSError *error = nil;
    
        NSArray *results = [self executeFetchRequest:fetch error:&error];
    
        if (error) {
            NSLog(@"MOC Fetch - Unresolved error %@, %@", error, [error userInfo]);
            return [NSArray array];
        }
    
        return results;
    
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The standard model has been that OpenGL is for professional apps (CAD) and Direct3D
I have a pretty standard table set-up in a current application using the .NET
Can standard pointers in .Net do this? Or does one need to resort to
So standard Agile philosophy would recommend making your domain classes simple POCOs which are
In standard ASP.net applications ASP.net offered some protection from XSS attacks with validateRequest throwing
In standard php or source code based projects we easily keep all of the
Using standard mysql functions is there a way to write a query that will
The standard naming convention in the Java world is to name packages, classes and
Is there a standard convention (like phpdoc or python's docstring) for commenting C# code
Is there a standard library method that converts a string that has duration in

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.