Re: Core Data : BlogDemo tutorial : I must have missed something, but I don't know what...
Re: Core Data : BlogDemo tutorial : I must have missed something, but I don't know what...
- Subject: Re: Core Data : BlogDemo tutorial : I must have missed something, but I don't know what...
- From: "John Joyce" <email@hidden>
- Date: Sun, 22 Jun 2008 12:01:55 -0500
On Sat, Jun 21, 2008 at 5:12 PM, Jens Alfke <email@hidden> wrote:
>
> On 21 Jun '08, at 2:40 PM, John Joyce wrote:
>
> 2008-06-21 16:27:05.212 BlogDemo[1180] *** NSRunLoop ignoring exception
>> '[<NSManagedObject 0x3434e0> valueForUndefinedKey:]: this class is not key
>> value coding-compliant for the key topic.' that raised during posting of
>> delayed perform with target 3c4ac0 and selector 'invokeWithTarget:'
>>
>
> This shows that an exception got raised, which is likely to screw up
> anything past that point. The message shows that something tried to access
> the value for key "topic" on a managed object that didn't support it.
>
> [Or is the key name really "topic." with a period? I'm not sure whether the
> period in the message is part of the key name. Try searching for "topic." in
> your code to see if you have a spurious period.]
>
> If that doesn't narrow it down enough, set a breakpoint at
> objc_exception_throw (using the breakpoints window) to find out exactly
> where the exception gets thrown.
>
> —Jens
I found the bug! Turns out, I forgot to put anything in the Entity Name
field in the Attributes Inspector for the NSArrayController for Topics. The
field was blank, but should have been "Topic".Wow. What a horrible little
bug to track down.
I hope the workflow of Core Data is much cleaner in Interface Builder 3
(when my MacBook returns from repairs...)
It certainly seems to me that in XCode 2.x, the Interface Builder workflow
for Core Data is not the best it could be for Core Data. The Data Modeler is
pretty nice. I found myself thinking Ruby on Rails' ActiveRecord needs
something that visual. Unfortunately for Core Data, all of the various
settings (that need to be correct and correspond to each other) are spread
out and within so many different views of the Inspector palette, it can be
hard to make sure you have everything correct.
Maybe it comes with experience, but something tells me there could be a more
concise way to view and work with these things in Core Data.
Ruby on Rails' ActiveRecord sometimes suffers a similar problem.
The code feels a bit like spaghetti code (think old BASIC from the 80's with
goto statements).
I do believe the programmer should and could easily be alerted that there is
no Entity Name set!
Obviously, the Entity Name is crucial to making Core Data controllers work.
(anyway, thanks Jens!)
_______________________________________________
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