Note: This article is written, there are better ways to produce it.
Note: You can use Threads (nsthread), GCD, or operationqueue to operate.
Using thread confinement to support concurrency
Each thread must have its own managed object context. Here are two possible modes.
1. Each thread creates a managed object context, sharing a persistent store coordinator. This is the recommended mode.
2. Each thread has a separate Manged object context, and persistent store coordinator.
This mode of expenditure is relatively large
If you are using Operationqueue, create a context inside the main or Start method.
If thread is closed, managed objects or managed object contexts cannot be passed between threads.
If you let it create a context between threads, it will go beyond the bounds of the thread.
-Find object by Objectid
-Perform a fetch to find the context
This allows you to find the local version of the managed object in the local context.
You can use Nsfetchrequest to provide a way to traverse threads more easily.
Processing core data operations under multi-threading