Simple Core Data Question
Simple Core Data Question
- Subject: Simple Core Data Question
- From: "Dave DeLong" <email@hidden>
- Date: Tue, 29 Jul 2008 21:41:02 -0600
Hi everyone,
I'm taking a stab at Core Data and am starting to grok how it works.
I've built a couple of small test apps to try different configurations
of entities and relationships, and whatnot. However, I've come up
against a snag.
Here's the layout: I've got two entitles, "State" and "City".
"State" has one attribute, "name" (a string), and a to-many
relationship to City. City has a name and a description (also a
string). It has a relationship to State (not to-many) with the
inverse relationship set to the State's "cities" relationship.
I've built an interface in IB: I have a tableView that lists all the
States, and then a tableView that lists all the cities in the selected
state. However, when I try to add a textfield that's bound to
CitiesArrayController.selection.description, I get an exception
thrown. The printout in the console reads:
CoreData Test 3[16798:10b] An uncaught exception was raised
CoreData Test 3[16798:10b] Cannot create BOOL from object ( ) of class NSCFArray
CoreData Test 3[16798:10b] *** Terminating app due to uncaught
exception 'NSInternalInconsistencyException', reason: 'Cannot create
BOOL from object ( ) of class NSCFArray'
The stack trace reveals:
#0 0x94facff4 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ ()
#1 0x917310fb in objc_exception_throw ()
#2 0x94facf2b in +[NSException raise:format:arguments:] ()
#3 0x94facf6a in +[NSException raise:format:] ()
#4 0x92442c50 in _NSHandleBindingException ()
#5 0x91fdd12f in _NSBoolFromValue ()
#6 0x91fdcb06 in -[NSEditableBinder
_setStatesImmediatelyInObject:mode:triggerRedisplay:] ()
#7 0x91fdc9b1 in -[NSEditableBinder
_observeValueForKeyPath:ofObject:context:] ()
#8 0x91fd9e77 in -[NSBinder _performConnectionEstablishedRefresh] ()
#9 0x91fd20e8 in -[NSObject(NSKeyValueBindingCreation)
bind:toObject:withKeyPath:options:] ()
#10 0x9200e71e in -[NSNibBindingConnector establishConnection] ()
#11 0x91de5aa4 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] ()
#12 0x91ddbe12 in loadNib ()
#13 0x91ddb774 in +[NSBundle(NSNibLoading)
_loadNibFile:nameTable:withZone:ownerBundle:] ()
#14 0x91ddb3b7 in +[NSBundle(NSNibLoading)
loadNibFile:externalNameTable:withZone:] ()
#15 0x91ddb2f5 in +[NSBundle(NSNibLoading) loadNibNamed:owner:] ()
#16 0x91ddafa4 in NSApplicationMain ()
#17 0x00002594 in main (argc=1, argv=0xbffff67c) at
/Users/dave/Developer/Cocoa/CoreData Test 3/main.m:13
Any ideas why adding the description field and binding it to the
selection.description might be related to this error? Or perhaps I'm
looking in the wrong spot?
Any insight is greatly appreciated. =)
Thanks!
Dave DeLong
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden