Core Data Problem

Christiaan Hofman cmhofman at gmail.com
Wed Jan 9 09:57:06 PST 2008


That's all not relevant info. The question is what you're doing to  
the data model. Are you inserting an ListItem object, and how?  
Changing a property of any object is not at all relevant to the add/ 
remove methods.

Christiaan

On 9 Jan 2008, at 3:17 PM, Steven Hatfield wrote:

> Christiaan,
>
> Thanks for your quick reply. You are absolutely correct, that's  
> what I get for posting before my morning intake of caffeine... ;-)
>
> To test it I am compiling in Debug mode, I placed a breakpoint on  
> the NSLog() line and pressed "Debug". I brought up the console and  
> the NSLog() call never fires, and the breakpoint is never hit, even  
> though I can see in the GUI that the object is being used. The  
> awakeFromInsert: *is* being called, I see NSLog() output in the  
> console from that method.
>
> My intention is to get the ListItem object that is being inserted  
> into the "Listing" object's ListItems (collection? What would it be  
> called? Like I said... I'm a newbie...), and modify one of its  
> properties, "itemNumber" to contain the count of the # of listItems  
> that are in the Listing to which it belongs.  I thought it best to  
> do this from the Listing object itself, since from the wording of  
> the method it receives some hint that a new listItem is being  
> inserted into it.
>
> It's really just a simple app to get familiar with Core Data, after  
> working through Hillegass' awesome intro to Mac OS X Programming  
> book. He doesn't cover Core Data, so it's very new to me...
>
> There are likely other, better ways to do this, but hopefully with  
> your help, I can figure it out.
>
> Thanks,
> Steven
>
> On Jan 9, 2008, at 8:16 AM, Christiaan Hofman wrote:
>
>> You've detailed the code part, but you didn't tell us what you did  
>> to test it. So we still do not know what actually failed. It may  
>> well be that your expectations are wrong. In fact, that seems to  
>> be the case from your explanation. You say that you have problems  
>> when the "NSManagedObject needs to set some data". That usually  
>> means changing a property. Than you go on describing methods to  
>> modify a relationship. So what are you actually modifying?
>>
>> Christiaan
>>
>> On 9 Jan 2008, at 2:05 PM, Steven Hatfield wrote:
>>
>>> Hi All,
>>>
>>> I am a newbie ObjC/Cocoa programmer, and I have a small core data  
>>> application that I am writing. Everything works fine when the  
>>> user enters data - save/open, display, etc.
>>> Where I am running into a problem is when the NSManagedObject  
>>> needs to set some data; I simply can't get the methods to be called.
>>>
>>> I used Xcode to generate the Managed Object Class, which includes  
>>> the code:
>>>
>>> @interface Listing (CoreDataGeneratedAccessors)
>>> - (void)addListItemsObject:(ListItem *)value;
>>> - (void)removeListItemsObject:(ListItem *)value;
>>> @end
>>>
>>> in the interface file, and I called the method in the  
>>> implementation file:
>>>
>>> - (void)addListItemsObject:(ListItem *)value
>>> {
>>> 	NSLog(@"Here");
>>> }
>>>
>>>
>>> I have verified that the "awakeFromInsert:" method is called on  
>>> that class, and the code compiles fine, but I never see "Here" in  
>>> the console and when I put a breakpoint on the NSLog() line, it  
>>> is never hit.
>>>
>>> In the code listings in the NSPersistentDocumentTutorial, it  
>>> appears that this should work fine... what am I doing wrong?
>>>
>>> I appreciate any help.
>>>
>>> TIA,
>>> Steven
>>> _______________________________________________
>>> MacOSX-dev mailing list
>>> MacOSX-dev at omnigroup.com
>>> http://www.omnigroup.com/mailman/listinfo/macosx-dev
>>
>> _______________________________________________
>> MacOSX-dev mailing list
>> MacOSX-dev at omnigroup.com
>> http://www.omnigroup.com/mailman/listinfo/macosx-dev
>



More information about the MacOSX-dev mailing list