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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:07:48+00:00 2026-05-13T17:07:48+00:00

I have an custom class for an Core Data entity, called ‘Friends’. As I

  • 0

I have an custom class for an Core Data entity, called ‘Friends’. As I am parsing an XML File, I need to create temporary instances to hold temporary data, without using Core Data at this point. So there are two options:

A) create an NSMutableDictionary to hold the temporary data while parsing an “object” from the XML.

B) use the class of the entity to store temporary data while parsing. I would prefer that, because it is more clear and more DRY for me, since the data structure is declared in there already and I wouldn’t have to duplicate the whole data model of that entity in an NSMutableDictionary.

But B has a problem: By default, all the properties are @dynamic, and as far as I know, Core Data takes care of creating the implementations at runtime. So I can’t just use the properties there. So this raises the question if it’s worth the effort and even possible to modify that class in such a way that it can be used without Core Data as a temporary data container object, i.e. by creating instance variables. Of course, if I had to create an dictionary in there to hold the temporary data, that would make no sense at all, and I would just go with A.

  • 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-13T17:07:48+00:00Added an answer on May 13, 2026 at 5:07 pm

    UPDATE: It sounds like you can use a nil context (see Adam’s answer below)

    Unfortunately, the only way to instantiate a managed object subclass is by inserting it into a context.

    Using a mutable dictionary (NSMutableDictionary) is the best approach since you can use setValuesForKeysWithDictionary: to populate the new managed object with a single method call.

    Another approach would be to insert the managed object and then delete it if you determine that it is not new. If you haven’t saved, the object will never even have been written to the persistent store.
    Note: this assumes that you determine if the object is new before adding its unique ID or you exclude the temporary objects (with an attribute or filtering out using a collection of them) when fetching the unique ID(s) so that you are only checking objects that existed previously.

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

Sidebar

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.