Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core data: Transient values dirty object

I'm using transient values to provide some data within my application. The trouble is, as soon as these values are calculated, it dirties my Managed Objects, reporting that a re-save is necessary.

Is there anyway to prevent transient values from marking an object as dirty if there are no actual changes to the object graph.

Thanks,

like image 617
Tricky Avatar asked Jan 28 '26 20:01

Tricky


2 Answers

Check out this awesome post on transient properties in core data. It explains things far better than I can in this short space, plus I'm still getting my head around this!

This guy recommends using an IsValid flag and a Snapshot ivar to deal with this issue, I think.

like image 165
John Gallagher Avatar answered Jan 30 '26 11:01

John Gallagher


Could you declare the fields as unmanaged properties in your data model class (i.e. they are defined in the source code, but not included in the data model)?

like image 45
Andrew Ebling Avatar answered Jan 30 '26 11:01

Andrew Ebling



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!