xcode


CoreData in one single separate thread


What I want in short is:
Core Data that runs without blocking the main thread
entities with relationships
bindings in InterfaceBuilder
I have tried 'everything', but it turned out that there are too many difficulties with Core Data on two or more threads and two NSManagedObjectContexts and bindings and entities with relationships and so on. These threads can make CoreData very complicated.
Nevertheless I want to use Core Data and I want it to run in the background for good UI response.
So I wonder, is it possible to completely run everything related to Core Data in one separate thread, which is not the main thread?
I will send everyone 50 bucks, if I finally find a solution that works...
I used two NSManagedObjectContext instances to push some longer lasting data tasks onto another thread with Grand Central Dispatch.
As long as you be careful to merge this context with the one on the main thread used to fetch data then you should be able to get some performance that way.
I am not sure if this can help you, but perhaps you can create a new NSOperationQueue and add whatever core data functions you need to in the background. So in your class have a property that is NSOperationQueue, then in the -viewDidLoad methods, you create new one:
myOperationQueue = [NSOperationQueue new]; Whenever you want to do an operation you can add it to the queue and I believe that it will execute on a separate thread (self.myOperationQueue addOperation: someFunction) and if you want to interact with the main thread, then call assert([NSThread isMainThread]) in the beginning of your method call. I am using Core Data and threading in a different way, but from the second thread I am able to create a temp object that the NSManagedObject is created from.

Related Links

productbuild - Resources not copying
Copy the complete content of general NSPasteboard
XCode XCAssets and autocompletion
Xcode Folder references > missing files
How do you auto build custom included frameworks or “kits” in Xcode?
resubmitting to App Store, should I increase version number or build in xcode?
Code Signature Invalid
I can no longer comment code using Xcode 8.0
Stack guard causing crash C++ Memory allocation of Vector
How to find object by debug - address in xcode
Unable to boot simulator xcode 7.3.1 / OS 10.11.6
xcodebuild pass arguments to application on iOS
iMessage sticker app size export in xcode
XCTest unit test don't work because of framework signature
Xcode SVN authentification failed
run xcode ui test from command line in xcode 8 using swift 2.3

Categories

HOME
typelite
seedstack
jms
android-fragments
exchange-server
workflow
ant
iverilog
lvm
drag-and-drop
scheduler
anchor
log4j2
migrate
fbloginview
squid
google-tasks-api
l20n
tfsbuild
angular2-highcharts
maven-surefire-plugin
sybase-ase
pdf.js
environment
introspection
webviewclient
ccavenue
iwebbrowser2
bonita
ninject
bitbake
basic-authentication
guice
d3.js-v4
toad
epplus
osx-lion
dreamfactory
xvfb
cargo
telephonymanager
widestring
praat
hypothesis-test
opal-framework
code-push
aws-kinesis-firehose
hibernate-ogm
jgrapht
subforms
android-webservice
simple-schema
nslayoutconstraint
deedle
predicates
perl-data-structures
ternary-operator
tablespace
xcode8-beta4
ajaxmin
as3-api
ibm-was
nette
asp.net-web-api-helppages
netdatacontractserializer
unhandled
uitest
mobilefirst-server
textscan
ampersand
wicked-gem
r.java-file
kognitio-wx2
global-scope
inputbox
object-code
osascript
xcode6.3.1
redpitaya
incognito-mode
radius-protocol
notin
tfs-sdk
2d-vector
cyrillic
taskkill
pcspim
multidrop-bus
background-repeat
libxslt
tessellation
stretchblt
datagridcolumn

Resources

Encrypt Message