• 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: ArrayController, CoreData & Bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ArrayController, CoreData & Bindings


  • Subject: Re: ArrayController, CoreData & Bindings
  • From: mmalcolm crawford <email@hidden>
  • Date: Mon, 8 May 2006 20:21:56 -0700


On May 8, 2006, at 6:29 PM, Bobby B wrote:

This is what I'm trying to do: Upon the first run of my app, it
checks to see if there are any entries in some of the tables, which
are bound from the array controller to their CoreData models.
[...]
int weatherCount = [[weatherArray
valueForKeyPath:@"arrangedObjects.@count"] intValue];
NSLog (@":%d", weatherCount);
if (weatherCount == 0) {
[weatherArray add:self];
[weatherArray setSelectionIndex:0];
[weatherArray setValue:@"Hot & Sunny" forKeyPath:@"selection.weather"];


Don't do this.
If you want to set up default data, create the required instances directly.


<http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/ Articles/cdCreateMOs.html>
<http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/ Articles/cdUsingMOs.html>


If you're using NSPersistentDocument, this is illustrated in the tutorial.
If you're not, and if you don't have any other means of determining whether this is the first run -- such as, for example, whether the store file exists..., then execute a suitable fetch and check the results.


mmalc

_______________________________________________
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


References: 
 >ArrayController, CoreData & Bindings (From: "Bobby B" <email@hidden>)

  • Prev by Date: Re: ArrayController, CoreData & Bindings
  • Next by Date: Re: Cocoa software design issue
  • Previous by thread: Re: ArrayController, CoreData & Bindings
  • Next by thread: Two simple questions regarding Cell
  • Index(es):
    • Date
    • Thread