mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Asserting when CoreData thread debugging is enabled #24
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JoeMatt on GitHub (Dec 18, 2015).
When activating the CoreData launch flag
-com.apple.CoreData.ConcurrencyDebug 1all of the included tests assert at the first managed object creation attempt.@JohnEstropia commented on GitHub (Dec 18, 2015):
Thanks for the feedback!
Yup, this is expected to happen. The
com.apple.CoreData.ConcurrencyDebugflag lets Core Data tell you when the managed context is accessed from any queue other than its own, which includes CoreStore's transactions' queues (beginAsynchronous(), etc).CoreStore already guarantees safety for you by making the Main Context read-only, and by only allowing updates to be made within transactions. You should be safe even without the ConcurrencyDebug flag (as long as you don't do hacky things).
I'll close this for now but feel free to ask if you have other questions :)
@JoeMatt commented on GitHub (Dec 18, 2015):
Would storing the managed object returned from a synchronous fetch as a Swift computed property be "hacky"
Trying to debug why we see random faults and that's about the strangest thing I think we're doing.
@JohnEstropia commented on GitHub (Dec 18, 2015):
Do you mean something like this?
If so then it should be fine.
I'm also curious what you meant by "random faults". If you are editing the object from inside a transaction, the object stored in the property is expected to refetch its new values (and is probably what you are observing).