Skip to content

Concurrency with Core Data #2

Open

Description

@langyufei

I am not sure when but it seems Apple supports concurrency programming with Core Data in two ways:
"There are two possible ways to adopt the pattern:

Create a separate managed object context for each thread and share a single persistent store coordinator.
This is the typically-recommended approach.

Create a separate managed object context and persistent store coordinator for each thread.
This approach provides for greater concurrency at the expense of greater complexity (particularly if you need to communicate changes between different contexts) and increased memory usage."

I know, it still requires us to carefully manage things.
Do you available for updating the "CoreDataStack" in stead of an assertion in code?

reference: http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/coredata/Articles/cdConcurrency.html#//apple_ref/doc/uid/TP40003385-SW1

Activity

  1. adamgit commented on Oct 26, 2013

    @adamgit
    Owner

    Yes - With iOS 6, Apple added new features for CoreData that make it (finally) safe to use multi-threaded.

    However ... there were major bugs in those features (data-loss / corruption bugs in Apple's code!) that weren't fixed until the 6.1.x releases. It was very worrying that Apple was shipping core code with such bugs :(.

    Unfortunately, Apple refuses to tell us what is "fixed" and what is "broken", so we have to guess - and risk our customers' data. I'm still testing to see what works/doesn't work on iOS7, and I'm aiming to do a major update / rewrite of CoreDataStack when I have more info.

    In the meantime, I recommend selectively removing asserts etc as needed to make the classes work with iOS 6.1.x and iOS 7.x -- I've been using the new features, and they do make life a lot easier (when they work!)

  2. ryanthon commented on Oct 10, 2015

    @ryanthon

    Are there any plans on updating this class for new Core Data concurrency features?

  3. adamgit commented on Oct 11, 2015

    @adamgit
    Owner

    I wrote this mainly to work around bugs in Apple code, many of which (but
    not all) have now been fixed.

    If I were using CoreData on a legacy project right now, I'd update it. But
    for anyone doing new projects, I'd hope its not necessary?

    Some of the code is still useful, convenience stuff (I've used the
    choose-from-embedded-bundles on a few projects), but probably needs
    updating for iOS 9.

    On 11 October 2015 00:32:34 Ryan notifications@github.com wrote:

    Are there any plans on updating this class for new Core Data concurrency
    features?


    Reply to this email directly or view it on GitHub:
    #2 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions