• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: "No Selection" in Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "No Selection" in Core Data


  • Subject: Re: "No Selection" in Core Data
  • From: Chris Hanson <email@hidden>
  • Date: Sat, 25 Jun 2005 20:24:01 -0700

On Jun 25, 2005, at 10:27 AM, J Tichenor wrote:

I'm sure there is an easy answer to this: I have two Entities, one is a single Budget entitiy and then any number of user added EffectUnits in relation to the budget.

It's always very useful to distinguish between entities (descriptions of the types of things in your application) and instances of entities (the things themselves). So in your model, you have two entities, Budget and EffectUnit. You have a one-to-many relationship between Budget and EffectUnit, so one Budget instance can be related to any number of EffectUnit instances.


Once everything is wired up, I can add EffectUnits without issue, but the properties of Budget show up as No Selection in it's relevant fields.

Are you creating an instance of Budget?

I'm sure it has something to do with not properly instancing the Budget Entity when the program launches -- I guess my assumption as a programmer is that the Budget entity should automatically instance when the program starts as it must exist

It sounds like you're not creating an instance of Budget. The framework has no way of knowing that a Budget instance "must" exist -- that's an application-level decision. After all, it may be perfectly valid in your application to have a document containing no Budget instances, or to have a document containing fifty Budget instances.


-- but I don't know how to instance the Budget and where -- probably in AppDelegate, right? Maybe in managedObjectContext? I've tried to find the spot but must admit the autogenerated code doesn't necessarily make itself apparent...

The template code is just a starting point. What you probably want to do is check the contents of the persistent store after adding it to your application's coordinator. Then if it contains no Budget instances, create an initial one and configure it as appropriate. Where exactly you would do this depends on what type of application you're building (document-based or other) but the way you would do so is the same.


  -- Chris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: "No Selection" in Core Data
      • From: mmalcolm crawford <email@hidden>
References: 
 >"No Selection" in Core Data (From: J Tichenor <email@hidden>)

  • Prev by Date: How to support 'every' object in script interface
  • Next by Date: Re: "No Selection" in Core Data
  • Previous by thread: Re: "No Selection" in Core Data
  • Next by thread: Re: "No Selection" in Core Data
  • Index(es):
    • Date
    • Thread