• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Removing Object form ArrayController without managedObjectContext
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 08:50:52 +0200

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

  • Follow-Ups:
    • Re: Removing Object form ArrayController without managedObjectContext
      • From: Gustavo Pizano <email@hidden>
References: 
 >Removing Object form ArrayController without managedObjectContext (From: Gustavo Pizano <email@hidden>)
 >Re: Removing Object form ArrayController without managedObjectContext (From: Keary Suska <email@hidden>)
 >Re: Removing Object form ArrayController without managedObjectContext (From: Gustavo Pizano <email@hidden>)
 >Re: Removing Object form ArrayController without managedObjectContext (From: Keary Suska <email@hidden>)

  • Prev by Date: Re: Core Data doesn't save toMany relations please HELP :S
  • Next by Date: Re: Removing Object form ArrayController without managedObjectContext
  • Previous by thread: Re: Removing Object form ArrayController without managedObjectContext
  • Next by thread: Re: Removing Object form ArrayController without managedObjectContext
  • Index(es):
    • Date
    • Thread