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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:49:59+00:00 2026-05-25T20:49:59+00:00

I am following Core Data Utlity Tutorial to understand the ground work needed in

  • 0

I am following Core Data Utlity Tutorial to understand the ground work needed in order to make Core Data work. This utility creates a Core Data storage and saves the process id and run date & time every time it runs. It also shows the details of previous runs.

Everything was going fine till managed object class is defined. It is defined as below:

@interface Run : NSManagedObject
{
    NSInteger processId;
}

@property (assign) NSInteger processId;
@property (retain) NSDate* date;
@property (retain) NSDate* primitiveDate;

@end

It defines 2 different date properties. Tutorial also defines a method in which primitiveDate is set when a new object is inserted.

- (void) awakeFromInsert {
    [super awakeFromInsert];
    self.primitiveDate = [NSDate date];
}

I don’t understand why we are setting primitiveDate instead of date property. I don’t even know why primitiveDate is even defined when all we needed was date and processId. I tried to read between the lines (after reading all the lines), but still couldn’t get it. Please can you help? I don’t know what am I missing.

  • 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-25T20:49:59+00:00Added an answer on May 25, 2026 at 8:49 pm

    The important line is

    The primitive accessors do not emit KVO notifications that cause the change to be recorded as a separate undo event.

    in the documentation you quoted. The difference between

    self.date = [NSDate date];
    

    and

    self.primitiveDate = [NSDate date];
    

    is that the former issues the Key-Value-Observing (KVO) notifications, but the latter doesn’t. The built-in undo system of Cocoa+CoreData looks for the KVO notification to properly prepare the undo stack. This means that, if you do the former, you can undo that operation from the UI, which you probably do not want.

    It’s a subtle difference which becomes important as your program become bigger and more mature.

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

Sidebar

Related Questions

I'm following this how-to to implement Core Data storage in my app: I have
Kind of following this tutorial here: http://mobile.tutsplus.com/tutorials/iphone/iphone-core-data/ I use the fetch records method in
Been following the Core Data tutorial on Apple's developer site , and all is
I am just learning Core Data on iPhone and the tutorial I am following
This is my first time with core data, and I am getting the following
I'm following Apple's Core Data Tutorial for iOS and am having issues pretty early
I have the following core data model with two entities: entity item which holds
I've got a core data-based app for iPhone and I'm getting the following warning:
So in looking through Core Data Snippets , I found the following code: ...
I'm following the example Navigation View template with core data in the latest iOS

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.