Adding objects using Bindings/CoreData
Adding objects using Bindings/CoreData
- Subject: Adding objects using Bindings/CoreData
- From: Niko Matsakis <email@hidden>
- Date: Mon, 23 May 2005 17:39:46 +0200
I am trying to get my bearings in this brave new world of Bindings
and Core Data and having some difficulty. I did some searching of
the list without success to see if anyone had encountered this
particular problem. I am building up a flashcard application (partly
as an exercise, but eventually because I intend to use it).
High level summary:
1. I have an interface with multiple tabs. In several places the
user is expected to pick a language from a drop down list, and then
other things are populated based on the language selected.
Initially, I created separate Array Controllers for each of these
lists; however, I found that when I added new languages (using
[ArrayController new]) only the array controller in question was
updated and the others did not have the new item. So I switched to
using one Array Controller, as I saw in one of the Cocoa Data
examples. Is this the right thing to do? It seems wrong to me,
because the set of currently selected items is contained within that
controller and these different controls have different selections.
2. Perhaps related, I am unable to add words to a language; the
intention is that the user selects a language from a pull down list
as described above, and then can add words to the chosen language,
but I encounter errors when attempting to do so.
Here is more detail:
I have created a simple Object Graph where you have Dictionaries,
which contain Languages, which are sets of words. Words from
different languages have references to each other to indicate they
are equivalent.
In any case, I am now just trying to get something up and running in
coredata where I can create a new language in a dictionary and then
create a word in that language.
I have created two controller objects: Languages and Words.
Languages is just the set of Language entities from the Managed
Object Context (which is taken from 'File's Owner'). Words is set to
take its ContentSet from 'selection.vocabulary' from the Languages
controller, and has the same managed object context.
Creating a new Language seems to work fine. It populates the
relevant table, and the relevant pop-up buttons. I had some problems
when I tried to use independent array controllers for the different
pop up buttons, as described above; in that scenario, the new
languages would not appear everywhere, but only in the list where
they were added. Now that I am using a single array controller, that
seems to have gone away, but I am not sure that using a single array
controller will really work (again, as discussed above).
In any case, when the Words controller's [add] method is invoked by
pushing the "Add Word" button, I get this error:
2005-05-23 11:44:35.862 Flash[11922] *** NSRunLoop ignoring exception
'*** -[_NSFaultingMutableSet objectAtIndex:]: selector not recognized
[self = 0x3a8ed0]' that raised during posting of delayed perform with
target 3a8fc0 and selector 'invokeWithTarget:'
It is not clear to me what is invoking this method, or on whom, etc.
Niko
_______________________________________________
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