• 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: Keary Suska <email@hidden>
  • Date: Mon, 29 Mar 2010 18:18:52 -0600

On Mar 29, 2010, at 3:29 PM, Gustavo Pizano wrote:

> I have, Invoice < ->> ItemXInvoice << > Invoice,  the Array controller I set up with ItemXInvoice entity, and when I click an add button I do:

Whenever possible, manipulate relationships directly. Perhaps you do this, but the code isn't shown. If your array controller is bound to the relationship, you shouldn't have make any calls to it at all. It will update itself. If it isn't updating, it means you aren't using your relationships properly.

> 	Item  * newItem = [NSEntityDescription insertNewObjectForEntityForName:@"Item" inManagedObjectContext:[self managedObjectContext]];
> 	ItemXInvoice * newItemXInvoice = [NSEntityDescription insertNewObjectForEntityForName:@"ItemXInvoice" inManagedObjectContext: [self managedObjectContext]];
> 	[newItemXInvoice setValue:newItem forKey:@"toItem"];
> 	[newItem addToInvoiceXItemsObject:newItemXInvoice];
> 	[_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.

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>)

  • Prev by Date: Re: AppleScriptability Meets NSOperation
  • Next by Date: Re: CIFilter and grayscale image
  • Previous by thread: Re: Removing Object form ArrayController without managedObjectContext
  • Next by thread: Re: Removing Object form ArrayController without managedObjectContext
  • Index(es):
    • Date
    • Thread