• 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
Core Data - nil-ing a relationship to a missing object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data - nil-ing a relationship to a missing object


  • Subject: Core Data - nil-ing a relationship to a missing object
  • From: Steve Steinitz <email@hidden>
  • Date: Wed, 26 Sep 2012 13:23:41 +1000

Hi,

If a Core Data to-one relationship is missing its target entity (and so throwing can't-fulfill-fault exceptions), how can I set the relationship to nil?

If I do

	object.missingObject = nil;

or

	[object setValue: nil forKey: @"missingObject"];

Core Data throws (when it tries to maintain the inverse relationship i.e. remove object from missingObject.objects).

If I do

	[object setPrimitiveValue: nil forKey: @"missingObject"];

Core data doesn't seem to know to save the object.  At least that's what I think is going on - in any case the relationship is not nil-ed in the store.

At present I have to delete the object (as the doc recommends), but I'd prefer to keep the object and just nil the broken relationship.

I'd prefer to not discuss preventing the situation.

Cheers,

Steve


-----

Avoid loud and aggressive persons for they are vexatious to the spirit - Desiderata


_______________________________________________

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

  • Prev by Date: NSWindowController and nib in framework
  • Next by Date: Re: nstableview without nsscrollview
  • Previous by thread: Re: NSWindowController and nib in framework
  • Next by thread: app developed for iPhone is compatible with iPad
  • Index(es):
    • Date
    • Thread