Re: Removing Object form ArrayController without managedObjectContext
Re: Removing Object form ArrayController without managedObjectContext
- Subject: Re: Removing Object form ArrayController without managedObjectContext
- From: Gustavo Pizano <email@hidden>
- Date: Tue, 30 Mar 2010 09:21:45 +0200
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@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