IT WORKS!!!!!!!! AHHH SUCH A RELIEF!
Thans a lot, guys, you made me see the problem I was having, so I set up the
Set Content binding of the ItemXInvoice Array controller to be
_newInvoice.toItemsXInvoice properly set the relation in the add and
addPredifiened methods, and it did work!.
OMG 5 days trying to solve this and finally its done.. thanks a lot once again
Gustavo.
PS, I have remove the things that seem and were really wrong, as Ben told me.
On Mar 30, 2010, at 8:50 AM, Gustavo Pizano wrote:
> Keary Hello
> On Mar 30, 2010, at 2:18 AM, Keary Suska wrote:
>>
>>> Item * newItem = [NSEntityDescription
>>> insertNewObjectForEntityForName:@"Item" inManagedObjectContext:[self
>>> managedObjectContext]];
>>> ItemXInvoice * newItemXInvoice = [NSEntityDescription
>>> insertNewObjectForEntityForName:@"ItemXInvoice" inManagedObjectContext:
>>> [self managedObjectContext]];
>>> [newItemXInvoice setValue:newItem forKey:@"toItem"];
>>> [newItem addToInvoiceXItemsObject:newItemXInvoice]; //4
>>> [_itemsArrayController addObject:newItemXInvoice];
>>> if(_newInvoice == nil){
>>> _newInvoice = [NSEntityDescription
>>> insertNewObjectForEntityForName:@"Invoice" inManagedObjectContext:[self
>>> managedObjectContext]];
>>> }
>>> [_newInvoice addToItemsXInvoiceObject:newItemXInvoice];
>>>
>>> So Im creating a ItemXInvoice relate it to an Item and then relate it to
>>> the Invoice relationship as you say. Unless I misunderstood your point and
>>> the NSArrayController (ItemXInvoice) the Array Content binding shall be
>>> set to the instance with keypath: _newInvoice.toItemXInvoice... I dunno its
>>> late here in this part of the work, Im just rumble around..
>>>
>>> Any thoughts?
>>
>> I would need to know what the -add* methods do to make any suggestions.
>> Chances are, these methods are not updating the relationships properly.
>
>
> The above is he add IBAction that its called when I press a + button, First I
> create a new Item, then a ItemXInvoice, I relate them, I have line 4 as an
> extra there but originally wasn't there, then I add the object to the
> _itemsArrayController, ( which has as entity ItemsXInvoice and MOC the
> application's delegate's MOC), then if the invoice its null I create the
> invoice and set the relation to ItemsXInvoice.
>
> I thought this was the logical way to create-relate them.. did I miss
> something?
>
>
> Gustavo
>
>
>
>
>> Keary Suska
>> Esoteritech, Inc.
>> "Demystifying technology for your home or business"
>>
>
_______________________________________________
Cocoa-dev mailing list ([email protected])
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]