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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:38:10+00:00 2026-06-10T21:38:10+00:00

I have a problem with making changes to ManagedObjects and saving those changes to

  • 0

I have a problem with making changes to ManagedObjects and saving those changes to the persistent store.

What does work is deleting objects, inserting object. and fetching those objects. As said, i fail making a change to a fetched managed object.

I have two view controllers.
Both have a public property:

@property (nonatomic, strong) NSManagedObjectContext *managedObjectContext;

The AppDelegate.m file sets this property for the first view controller in the application:didFinishLaunchingWithOptions: method like so:

// get reference to view controller //
//..
controller1.managedObjectContext = self.managedObjectContext;

view controller1 again passes the managedObjectContext when pushing to the second view controller, it does this in the prepareForSegue: method like so:

// Get reference to the detail view //
MySecondViewController *controller2 = segue.destinationViewController;        
// Pass the managed object context //
controller2.managedObjectContext = self.managedObjectContext;

Within this second view controller I fetch objects from core data and I store them in a property of the view controller like this:

@property (nonatomic, strong) MyKindOfObject *object;
...
self.object = [fetchResults lastObject];

Fetching objects seems to work fine as i nicely get results..

The fetched object has a number of properties, one of them is of type NSString. The value of this property I show in a UITextField. The user can change the value here and when done he presses a button. I catch the action and I do the following:

self.object.mytext = textField.text;

followed by trying to save to core data:

// Save to CoreData //
NSError *error = nil;
if(![self.managedObjectContext save:&error]){
    // handle the error //
    NSLog(@"is error");
}
else{
    NSLog(@"no error");
}

1) The next time the user returns to this view controller, again the object will be fetched. But it still has the old value.

2) Also I use a Firefox add-on called SQLite Manager to keep an eye on the data within the related sqlite file. When stepping through the code, after calling the save method nothing changes in the file.

3) Also within Xcode i use the Variables View to keep an eye on the self.managedObjectContext object. When I am storing the new data into my object, right before calling save, none of the properties of self.managedObjectContext change (like unprocessedChanges or changedObjects).

4) I also added a call to the hasChanges method of the managedObjectContext, but this returns NO:

if([self.managedObjectContext hasChanges]){
   NSLog(@"changes managed object context!");
}

5) I also added a call to the hasChanges method of the related managedObject, but this also returns NO:

if([self.object hasChanges]){
    NSLog(@"changes in managed object!");
}

I am probably doing something totally wrong here but I can not figure out what it is.
I truly hope somebody can help me out?.
Thanks in advance!

  • 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-06-10T21:38:12+00:00Added an answer on June 10, 2026 at 9:38 pm

    Oke let me answer my own question: as the newby that I am, i indeed did something totally wrong. I was thinking I knew better then apple themselves. lesson learned: I do not!

    After creating entities within the model I created custom managed object classes for each entity (or actually NSManagedObject subclasses for each entity).
    Within the generated implementation files all properties (attributes) are implemented as @dynamic. Due to lack of knowledge I did not understand/recognise this. So the newby in me thought: lets change all that to @synthesize.

    Hopefully this post can help some other newby to not make the same mistake.

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

Sidebar

Related Questions

I have a problem with making changes to an object from within another model
So I have this little problem making this to work: I have silverlight client
I have a problem making an advanced (for me) query. I am trying to
I have problem with google map Loading and making center in my java script
I am making a CRUD application in jquery and i have this problem in
I have a problem and can't find a solution. I am making an accordion
i have a problem with updating my textview. i am making a c2dm app.
i'm making window component on Flash Professional CS4 and now i have 1 problem.
Beginner iOS dev here. I have a problem in my array. Im making an
I have a little problem, I'm making project and I'm sending data from client

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.