• 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: Strange Core Data save behaviour ("required relationship nil"... when it is set the line before saving)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: Strange Core Data save behaviour ("required relationship nil"... when it is set the line before saving)


  • Subject: re: Strange Core Data save behaviour ("required relationship nil"... when it is set the line before saving)
  • From: Ben Trumbull <email@hidden>
  • Date: Tue, 29 Sep 2009 18:59:58 -0400

Now, I have some code that changes the value of the 'B enumeration
value' that A is using.  This does the following:
1. Create a new instance of the B subentity that represents the value
we want (in the same MOC as A)
2. Delete the old B object that A was pointing to, i.e. [moc
deleteObject:B];
3. Set A's to-one relationship to point to the new B object (and for
good measure, set B's inverse relationship - though this should be
done automagically).
4. Save the moc

4. is where badness happens (failed to save).  The error tells me that
A's relationship property to B is nil... but just before I do the save
I log the value of the object referenced by this relationship and it's
the new 'B' object!
I have no idea what I've done to upset Core Data such that it claims a
relationship is nil when I save, but the line before the [moc
save:&err], the relationship shows as referencing a perfectly good
object.

So you delete B, which has an inverse relationship to A. Then you set a new B on A. Then you save, and delete propagation cleans up the graph, nullifying the old B's inverse relationship ?


What happens if you add a call to -processPendingChanges in between #2 and #3 ?

- Ben



_______________________________________________

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: Strange Core Data save behaviour ("required relationship nil"... when it is set the line before saving)
      • From: Luke Evans <email@hidden>
  • Prev by Date: Re: Some more questions on NSOpenPanel
  • Next by Date: Core Data Calculated Properties
  • Previous by thread: Re: Some more questions on NSOpenPanel
  • Next by thread: Re: Strange Core Data save behaviour ("required relationship nil"... when it is set the line before saving)
  • Index(es):
    • Date
    • Thread