diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/Asynchronous/NSManagedObjectContext+DCTAsynchronousTasks.m b/Asynchronous/NSManagedObjectContext+DCTAsynchronousTasks.m index f7990e7..6c78e9f 100644 --- a/Asynchronous/NSManagedObjectContext+DCTAsynchronousTasks.m +++ b/Asynchronous/NSManagedObjectContext+DCTAsynchronousTasks.m @@ -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]]; @@ -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];