Re: "No Selection", NSObjectController & CoreData
Re: "No Selection", NSObjectController & CoreData
- Subject: Re: "No Selection", NSObjectController & CoreData
- From: Thom Meijer <email@hidden>
- Date: Wed, 5 Oct 2005 02:49:26 +0200
I would like my core data app to be used by many users, that means many
persistent data stores, which don't have to be created on the first app
launch though, since in this case, it is sufficient to create the store when
the user decides to store something. And this something are few instances of
core data's entity manipulated by NSObjectController and NSArrayController -
basically a Master-Detail interface. Arrays for database, objects for
preferences since they are common for the whole database. My problem was
that I knew how to use array controller but to my little surprise the object
controller also needed an object to be added. So I guess, it is ok to have
something like init-button which in fact adds this one object to controller
and thereby the preferences become editable and storable.
Certainly, it can be done in a way you suggested as well. It just seems to
me that in this particular case it is perfectly doable without coding.
In any case, thank you very much, of course, for the very interesting link
you shared!
On 10/4/05, mmalcolm crawford <email@hidden> wrote:
>
>
> On Oct 3, 2005, at 7:54 PM, Thom Meijer wrote:
>
> > This is exactly what I was looking for. I can not help myself but
> > it feels
> > quite strange to me that also NSObjectController needs the one and
> > only
> > object to be added. In case of NSArrayController I pretty get it
> > but with
> > *object* controller....anyway!
>
> Sorry to be contrary, but are you sure this is what you want?
> It's not entirely clear what your goal is here, but from your
> description it *sounds* like you want a single instance of a given
> entity that should be created when the application first launches and
> persists thereafter? Something akin to the Department created in the
> persistent document tutorial:
> <http://developer.apple.com/documentation/Cocoa/Conceptual/
> NSPersistentDocumentTutorial/04_Department/chapter_5_section_1.html#//
> apple_ref/doc/uid/TP40001799-CH223>
> ?
>
> For a non-document-based application, you don't have the convenience
> of a special method that is invoked only when the document is
> created. Therefore, when you set up the persistence stack, you
> should execute a fetch request to determine whether the object
> already exists. If it doesn't then you should create it. (If you're
> creating a single store in a single location, then it may be more
> efficient to simply test whether the file exists when you set up the
> stack...)
>
> 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
>
_______________________________________________
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