Hello, all. I came up with a problem where my entity Invoice has a toMany relation to an entity called, ItemXInvoice, which hold the quantity and the total price, so when I create an Invoice I add ItemXInvoice's when clciking an add button, these ItemXInvoice's are stored in a NSArrayController. then wen I click the save button for the invoice I do the following:
if(_newInvoice == nil){ //If its equal nil then I create a new MO _newInvoice = [NSEntityDescription insertNewObjectForEntityForName:@"Invoice" inManagedObjectContext:[self managedObjectContext]]; //Setting the Relationship Witht the User. [(User *)[[[parent _userListArrayController] selectedObjects] objectAtIndex:0] addToInvoicesObject:_newInvoice]; //Settting the RelationShip To the Customer. [(Client *)[[_clientsArrayController selectedObjects] lastObject] addToInvoicesObject:_newInvoice]; } //Set the creationItemPrice for each ItemXInvoice for(ItemXInvoice * acutalItem in [_itemsArrayController arrangedObjects]){ [acutalItem setValue:[acutalItem valueForKeyPath:@"toItem.unitPrice"] forKey:@"creationItemPrice"]; [acutalItem setValue:[self getNewStatusEntity] forKey:@"toStatus"]; } [_newInvoice addToItemsXInvoice:[NSSet setWithArray:[_itemsArrayController arrangedObjects]]]; ... ... so then I jsut save the managedObjectContext, and there is no error. then when I want to check the invoice, I get the NSSet from the relation ship like this: NSArrayController * ctr = [(InvoiceLayoutViewController *)object _invoicesArrayController]; NSSet * temp = [(Invoice *)[[ctr selectedObjects] lastObject] valueForKey:@"toItemsXInvoice"]; NSLog(@"Changed selection %i",[temp count]); and the output I get is a 0, and sometimes, I see a 2 or 1, but normally its just 0, and of course I can't see the description of each invoice. I tried then saving first the ItemXIvnoices from the NSArrayController, but still same effect I get an empty set from the Invoice M.O, what can I do? what am I doing wrong? Thx Gustavo _______________________________________________ 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 arch...@mail-archive.com