Skip to content
This repository was archived by the owner on May 8, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
12 changes: 6 additions & 6 deletions Asynchronous/NSManagedObjectContext+DCTAsynchronousTasks.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ - (void)dct_asynchronousTaskWithObjects:(NSArray *)objects
[objectIDs addObject:[mo objectID]];
}

NSManagedObjectContext *threadedContext = [[NSManagedObjectContext alloc] init];
[threadedContext setPersistentStoreCoordinator:[self persistentStoreCoordinator]];

dispatch_queue_t asyncQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);

dispatch_async(asyncQueue, ^{

NSManagedObjectContext *threadedContext = [[NSManagedObjectContext alloc] init];
[threadedContext setPersistentStoreCoordinator:[self persistentStoreCoordinator]];

NSArray *threadedObjects = nil;
if (objectIDs) {
NSMutableArray *array = [NSMutableArray arrayWithCapacity:[objectIDs count]];
Expand Down Expand Up @@ -246,13 +246,13 @@ - (void)dct_asynchronousFetchRequest:(NSFetchRequest *)fetchRequest
withCallbackQueue:(dispatch_queue_t)callbackQueue
block:(DCTFetchRequestCallbackBlock)callbackBlock {

NSManagedObjectContext *threadedContext = [[NSManagedObjectContext alloc] init];
[threadedContext setPersistentStoreCoordinator:[self persistentStoreCoordinator]];

dispatch_queue_t asyncQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);

dispatch_async(asyncQueue, ^{

NSManagedObjectContext *threadedContext = [[NSManagedObjectContext alloc] init];
[threadedContext setPersistentStoreCoordinator:[self persistentStoreCoordinator]];

NSError *error = nil;
NSArray *array = [threadedContext executeFetchRequest:fetchRequest error:&error];

Expand Down