Monday, July 23, 2012 [Tweets] [Favorites]

Core Data Growing Pains

Whitney Young:

Today I’m going to discuss nested context support in Core Data and various issues that exist with them. Some of these issues are minor bugs. Others may be considered functionally correct by the Core Data team, but result in unexpected behavior. Regardless, they add up to nested contexts being a feature you should avoid completely (as of this writing).

One of the surprising issues is that Apple specifically recommends using nested contexts to do work in the background, yet if you use a nested context on a background thread it will block your user interface.

3 Comments

Parent context should be running in background thread, not on main thread. it's done wrong. It's expected behavior because while parent context should not block child context, a child can block its parent anytime.

Right, that's one way of solving the problem. Or maybe it's not a problem at all — it could be a design decision by Apple. But as mentioned in the article, there's nothing in the documentation that indicates that. You have to discover it on your own.

[…] Core Data Growing Pains – Nested context issues […]

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment