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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:33:52+00:00 2026-05-23T14:33:52+00:00

I was saving core data objects successfully until now. In this code, I’m searching

  • 0

I was saving core data objects successfully until now. In this code, I’m searching for some objects and want to update or add a property to the saved object.

Apparently it won’t save the changes, any idea why?

NSManagedObjectContext *managedObjectContext = ((VentoAppDelegate*) [[UIApplication sharedApplication] delegate]).managedObjectContext;
NSEntityDescription *entityDescription = [NSEntityDescription entityForName:EntityNameString inManagedObjectContext:managedObjectContext];
NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
[request setEntity:entityDescription];

NSError *error;
NSArray *objects = [managedObjectContext executeFetchRequest:request error:&error];
if (objects == nil) {
    NSLog(@"Error - Events=nil - %@", [error localizedDescription]);
}
if ([objects count] > 0) {
    for (NSManagedObject* object in objects)    {
        if (distance <= maxDistance) {
            if (bla-bla-bla) {
                [object setValue:[NSNumber numberWithBool:YES] forKey:@"notification"];
                [self saveContext];
            }
        }
    }
}

Thank you!

  • 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-23T14:33:53+00:00Added an answer on May 23, 2026 at 2:33 pm

    If you change managed object it is changed only in memory. You need to save managed context after changing anything. Add something like this:

    NSError *error;
       if (![object.managedObjectContext save:&error]) {
       // Update to handle the error appropriately.
       NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
       abort();  // Fail
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Core Data, is there some trick to saving changes to managed objects' attributes
I'm working on an application backed by Core Data. Right now, I'm saving the
I am having a lot of trouble getting m core data objects to be
In the generated code for core data stack, a save on managedObjectContext is called
I have a Core Data based mac application that is working perfectly well until
I'm trying to fetch objects from core data that are not in a given
Saving data to Postscript in my app results in a Postscript file which I
When saving data in different sql tables, is it best to use the GUID
I am saving some small images to Xml as a Byte[] via the following
My Java application is saving stuff in 'user.home' but on windows this does 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.