• 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: Bindings / Core Data: Ensuring a value is unique
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings / Core Data: Ensuring a value is unique


  • Subject: Re: Bindings / Core Data: Ensuring a value is unique
  • From: Chris Blunt <email@hidden>
  • Date: Thu, 14 Sep 2006 17:19:10 +0100

Sorry, shadow copy probably isn't the best description...long day staring at code :) Basically, I have two NSArrayControllers that both look at the same entity (is this a bad thing to do?). The reason being whilst one arraycontroller *might* have a contentSet binding (depending on the user's selection), the other must always return every entity in the object graph:

Entity A --------------------------------
Entity B                                |
Entity C ---	                        |
Entity D    |                           |--- NSArrayController 2 (All)
Entity E    |---NSArrayController 1     |
Entity F    |	                        |
Entity G ---	                        |
Entity H --------------------------------

Here, all entities are returned by NSArrayController(2), but only entities DEFG are returned by NSArrayController(1). I hope this makes sense!

Anyway, the problem occurs when deleting one of the entities from either of those NSArrayControllers. Although it vanishes from the (current) controller, the entity remains in the other controller. It also doesn't appear to be a valid entry, as if I edit the 'shadow' entity in the other array controller, it is valid. I would take as meaning it is not a 'nil' value?

Again, I'm not sure if having two controllers for the same data is good practice, so please let me know if there is a better way to tackle this problem!

Thanks,
Chris
--
www.chrisblunt.com



On 14 Sep 2006, at 16:52, I. Savant wrote:


You'll have to define "shadow copy".

I'm not sure if this is what you're seeing, but objects are not immediately removed from the store when you delete them from a context. Rather, they are marked as "deleted" and removed when the store is saved. The Core Data Programming Guide explains this in detail.

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/ index.html

--
I.S.


On Sep 14, 2006, at 11:47 AM, Chris Blunt wrote:

I've got some strange behaviours appearing in my controllers now as well - deleted records seem to leave a 'shadow' copy of the record, despite multiple calls to [NSManagedObjectContext processPendingChanges] and [NSArrayController prepareContent].


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Bindings / Core Data: Ensuring a value is unique
      • From: "I. Savant" <email@hidden>
References: 
 >Bindings / Core Data: Ensuring a value is unique (From: Chris Blunt <email@hidden>)
 >Re: Bindings / Core Data: Ensuring a value is unique (From: "I. Savant" <email@hidden>)
 >Re: Bindings / Core Data: Ensuring a value is unique (From: Chris Blunt <email@hidden>)
 >Re: Bindings / Core Data: Ensuring a value is unique (From: "I. Savant" <email@hidden>)

  • Prev by Date: Re: Breakpoints working incorrectly in XCode / GDB?
  • Next by Date: Re: NSTextField not updating NSUserDefaults using bindings
  • Previous by thread: Re: Bindings / Core Data: Ensuring a value is unique
  • Next by thread: Re: Bindings / Core Data: Ensuring a value is unique
  • Index(es):
    • Date
    • Thread