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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:31:07+00:00 2026-06-08T11:31:07+00:00

I have a NSManagedObject SharePrices, which contains DateTime attributes and NSNumbers for share prices

  • 0

I have a NSManagedObject SharePrices, which contains DateTime attributes and NSNumbers for share prices and is stored in a standard Core Data “database”. As I want to group some of the share prices by month, I would like to create new SharePrice objects for each month and store in each of these objects the average share price for the month, the date would be set to the last day of the month.

How can I store this monthly information in my SharePrices NSManagedObject without the need to create it by using insertNewObjectForEntityForName and saving it to the store. Or would I need to create a category for the managed object and put there the grouping code? Basically, I just want to reuse my existing SharePrice structure without any Core Data support.

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-06-08T11:31:08+00:00Added an answer on June 8, 2026 at 11:31 am

    I would strongly recommend against re-using NSManagedObject-derived objects outside of database context. The opportunity to reuse a few fields here and there does not worth the loss of clarity that will result from such an approach.

    The problem is, the aggregated share price object that you are planning to create does not represent a share price – instead, it represents a share price aggregation for a time period. Therefore it is not a good idea to use the same class to represent both kinds of objects: they are conceptually different. Another problem with your approach is that NSManagedObject includes a lot of things that are of no use outside of database context, such as object ID, a reference to the managed object context, and so on. Keeping them around in a meaningless state would be misleading to anyone maintaining your application.

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

Sidebar

Related Questions

So I'm fairly new to Core Data and KVO, but I have an NSManagedObject
My NSTreeController is setting Core Data parent attributes but not children attributes. I have
I have a core data NSManagedObject named CD_CoffeeShop . When i allocated a variable
I have a subclass of NSManagedObject Class used with Core Data in iPhone. However,
It is possible to have one NSManagedObject subclass represent multiple Core Data entities. For
I have one table in my core data source which holds some articles with
i have an array of NSManagedObject take from my core data, and i want
I have a Data class that subclasses NSManagedObject with a single bool property attribute.
I have a few entities which are managed by custom NSManagedObject classes. They are
I have a NSManagedObject subclass named Tour. I stored the reference to it using

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.