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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:07:50+00:00 2026-06-17T17:07:50+00:00

I have an application, which stores the data in Core Data Managed Objects. These

  • 0

I have an application, which stores the data in Core Data Managed Objects. These objects contain several properties – information as NSString, Boolean as NSNumber and an data array as Transformable.

dataPoint.h:

@property (nonatomic, retain) id dataArray;
@property (nonatomic, retain) NSString * note;
@property (nonatomic, retain) NSNumber * bool;

dataPoint.m:

@dynamic dataArray;
@dynamic note;
@dynamic bool;

The application user can make changes and store or cancel them. To undo all changes I call the [managedObjectContest rollback] method. I haven’t set up an additional undoManager.
For simple data types (like NSString or NSNumber) this works fine. After the rollback is called, all entries are in there last saved state. But this seems not to work for the stored Array. After rollback is called, I still only get the changed Values. Only after I restart the application, the original (last saved) data is shown.

What do I have to do to make the rollback work for complex data?

Thank you and kind regards!

  • 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-17T17:07:51+00:00Added an answer on June 17, 2026 at 5:07 pm

    You could simply re-fetch the entity after the rollback. In this way, the data from the persistent store (presumably the correct data) would replace the changed array.

    Another approach would be to just keep a copy of the old array and use that in displaying your data, if this is feasible (maybe not across multiple view controllers).

    An array as a property is a rather non-standard way of going about storing things in NSManagedObjects. The phenomenon happens because once you retrieve the array, you essentially get a pointer to it. You change the array, but the pointer stays the same. During rollback nothing has to be changed, so Core Data just does nothing. Your array in memory is not relevant for Core Data.

    It would be much better if you took the trouble and model the things in your array also in Core Data. It is likely to results in more explicit, readable and maintainable code, in addition to have a more solid data structure.

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

Sidebar

Related Questions

I have an application which stores data to the persistent store by setting the
In my application, I have three collection objects which store data. The data which
I have a navigation based application using Core Data and several levels of drill-down
We have an application which stores its data in SQL Server. Each table has
I have a Java web application which stores some data in the session. The
I have a multilingual java application which gets and stores data in MySql Database.
I have a Core Data application, which uses NSSQLiteStoreType as a persistent store. This
I have a simple application which stores the data into the sql server database
In my application i need to query core data, i have a table which
I have an application which donwloads several images and stores them on the phone.

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.