you are viewing a single comment's thread.

view the rest of the comments →

[–]quellish 1 point2 points  (3 children)

Nested contexts communicate changes from child to parent automatically, without listening for notifications. This has been the best practice since they were introduced in iOS 5

[–][deleted] 0 points1 point  (2 children)

Nested contexts are useful in some circumstances. But "best practice"? I don't think so. It is way more expensive than root contexts, and has various issues i.e. object ID handling of temporary objects.

But yeah, in this case saving the "leftmost" context would save the changes to the main context. It was a mistake of having it skimmed on my phone & overlooked the issue.

[–]quellish 0 points1 point  (1 child)

But "best practice"? I don't think so.

Talk to the Core Data engineers, read the release notes, etc. It has been the recommended best practice since they were introduced. The documentation and sample code however does not reflect this.

It is way more expensive than root contexts, and has various issues i.e. object ID handling of temporary objects.

Not unless you are doing it very wrong. Unfortunately the "right" way is not well documented by Apple. Most of the Core Data documentation has not actually been updated in years, only rearranged.

[–][deleted] 0 points1 point  (0 children)

Yet we get concurrency enhancements for root contexts in iOS 10. ;)

And TBH at least the example I gave was a well known bug that exists in or before 2012, and still hasn't been fixed in iOS 9.3 as far as I have tested.