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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:39:35+00:00 2026-06-06T07:39:35+00:00

I am developing a application that uses core data. In my application i would

  • 0

I am developing a application that uses core data. In my application i would like every user to have the same database. So i want all of the devices to share the same core data objects.

In order to do that ‘synchronization’ I found a presentation on this answer that discussed this matter. In the presentation, it is suggested that I add attributes such as ‘creationDate’ and ‘modificationDate’ to every object in Core Data.

So to do that, i tried to subclass NSManagedObject (MyManagedObject) in order to add those properties to every object in core data. I also made every NSManagedObject subclass I had (generated automatically by the model) subclass MyManagedObject.

The problem is that the properties I added to the NSManagedObject subclass do not persist in the database. So when I close and reopen the application, ‘creationDate’ becomes (null).

Here’s some of my code (header):

@interface MyManagedObject : NSManagedObject
@property (nonatomic, retain) NSDate * modificationDate;
@property (nonatomic, retain) NSDate * creationDate;
@end

And here’s the .m file:

@implementation MyManagedObject
@synthesize modificationDate, creationDate;
-(void)willSave {
    [super willSave];    
    self.modificationDate = [NSDate date];
}
-(void)awakeFromInsert {
    [super awakeFromInsert];
    [self setCreationDate:[NSDate date]];
    [self setModificationDate:[NSDate date]];
}

Any help, directions or reading would be greatly appreciated. I have been struggling with this for a while now. I need a better way than adding these attributes to EVERY single entity in the model. Thanks in advance

PS: i intend to have a ‘truth database’ (a .sqlite file) in a server. The synchronization will be between the server and the iPhone. Such as suggested in the presentation

  • 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-06T07:39:37+00:00Added an answer on June 6, 2026 at 7:39 am

    If you create MyManagedObject in the data model design tool and also register it as the parent of other entities inside that tool, this should almost work. (I suspect you didn’t do that because of the @synthesize statement…those would usually be @dynamic.)

    The one other problem to fix is that you have to test whether you’ve already changed an object’s property (self.modificationDate in your case) before changing it again or else willSave continues to get called. A BOOL value that gets set after the first change and cleared in didSave is a simple thing to test.

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

Sidebar

Related Questions

I am developing an application that uses the SKPSMTPMessage to send the forgotten user
I am developing an application that uses JS Tree with json data and ajax
I am developing the application that uses DirectX for graphics rendering. I have to
I'm developing an application that uses SQLite as the primary data storage method. I
I am developing sample application that uses Google Map API. I have generated Google
I'm developing a Java EE Application that uses JPA to persist its data. At
I'm developing a web application that uses PhoneGap:Build for a mobile version and want
I'm developing an application that uses Managed WiFi . Normally I would just add
I'm developing a java application that uses some jni calls. I have on C
I'm developing an web application that uses a non-relational database as a backend (django-nonrel

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.