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

  • SEARCH
  • Home
  • 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 6132409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:05:58+00:00 2026-05-23T17:05:58+00:00

All, I have Core Data implemented in my program to store customer information. Let’s

  • 0

All,

I have Core Data implemented in my program to store customer information. Let’s call each entity “CustomerInformation”. Each “CustomerInformation” entity has three properties, “count”, “property2”, and “property3”, where count is the number identifier for that specific entity.

So let’s say I have three “CustomerInformation” entities…

CustomerInformation
-count //for example, this would be "1"
-property2
-property3
CustomerInformation
-count //for example, this would be "2"
-property2
-property3
CustomerInformation
-count //for example, this would be "3"
-property2
-property3

When I delete “CustomerInformation” (2), the other two will keep their count. What I need to do at this point is loop through all of my entities (in this case three) and see where the missing value is (if I deleted “CustomerInformation” (2), 2 would be the missing value).

Here is my idea, but I need help completing it. Note: the 7 in the for loop is the max number of customers I want to store, don’t worry about that part though

NSFetchRequest *custRequest = [[NSFetchRequest alloc] init];
    ProjectAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
    NSManagedObjectContext *custContext = [appDelegate managedObjectContext];

    NSEntityDescription *customerInformation = [NSEntityDescription entityForName:@"CustomerInformation"
                                                  inManagedObjectContext:custContext];
    [custRequest setEntity:customerInformation];

    NSError *error;
    NSArray *array = [custContext executeFetchRequest:custRequest error:&error];

    for (int n=0; n<=7; n++)
    {
        //here I need it to go through and find the missing 2
    }
  • 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-23T17:05:59+00:00Added an answer on May 23, 2026 at 5:05 pm

    Searching through your entire database to deduce the count of an object that you just deleted seems the wrong way to go about it. Instead, you should record the count of any object(s) that you delete so that you can avoid this entire problem. Sure, it’s not a big deal when you’ve got seven objects in your database, but it won’t work very well when you’ve got tens of thousands.

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

Sidebar

Related Questions

I have a question concerning Core Data and how, if at all, Entities get
I have a Core Data store which contains a number of MediaItem entities that
On my Core Data Entity Book i have a boolean property, 'wasViewed' (NSNumber numberWithBool)
I have a Core Data model in which a Task entity includes an optional
I have a data-heavy app and I have implemented all my CoreData migration stuff
I have a Core Data based application which is built around one main entity.
In my services all exposed methods have: try { // the method core is
I am working on a simple Core Data app. I have two classes: Client
So I have 0.5MB XML file with data for my iPhone application. It's all
I'm familiar with Core Data basics and have done some dabbling, but have not

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.