Graham.
Thank you for the code.

so what I should do if I understand your code, is fetch my account's managed object,
before i insert any details.

Sandro.

On 10-Aug-08, at 9:51 PM, Graham Perks wrote:

On Aug 10, 2008, at 8:39 PM, Sandro Noel wrote:

So I think my question here, is, what should I use when inserting a detail object to properly set the relationship to Account. some example on how I should approach the problem would be nice, or a step-by-step :D

I do this, where I have an EventImage that refers back to a main Event, "self" is the managed object for the Event, which is your Account:

                                
// create new EventImage, this would be akin to your AccountDetails
            imageHolder = (EventImage*)
[NSEntityDescription insertNewObjectForEntityForName:@"EventImage" inManagedObjectContext: [self managedObjectContext]];

[imageHolder setImage:image]; // set some data in the new object

            // Add reference from Event to it's Image
            [self setValue:imageHolder forKey:@"imageHolder"];
        
// Add the reverse relationship, from the image back to the event.
            [imageHolder setValue:self forKey:@"event"];


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to