Skip to content

Commit

Permalink
Merge branch 'release/2.0.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
blackgold9 committed Nov 4, 2012
2 parents 58f463d + fb81b5b commit 8861927
Show file tree
Hide file tree
Showing 13 changed files with 153 additions and 97 deletions.
59 changes: 59 additions & 0 deletions Changelog.md
@@ -0,0 +1,59 @@
# Changelog
## Version 2.0.8
* Fixed issue #287 - MR_findByAttribute:withValue:andOrderBy:ascending:inContext does not pass context through `4b97d0e` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
## Version 2.0.7
* Fix small error in README with regard to MR_SHORTHAND `8c14cc7` - [Maik Gosenshuis](mailto:maik@gosenshuis.nl)
* Hide intended private cleanUpErrorHandling method `a903e7e` - [Saul Mora](mailto:saul@magicalpanda.com)
* Call completion handler on main thread. `c639ce4` - [Brandon Williams](mailto:brandon@opetopic.com)
* Persist changes to disk when using: - [NSManagedObjectContext MR_saveInBackgroundErrorHandler:completion:] methods, AND the context is the default context - [MagicalRecord saveInBackground…] methods `8bb0d0d` - [Saul Mora](mailto:saul@magicalpanda.com)
* [NSManagedObjectContext MR_saveInBackgroundErrorHandler:completion:] `f0246e9` - [Jwie](mailto:joey.daman@twoup.eu)
* [NSManagedObjectContext MR_saveInBackgroundErrorHandler:completion:] `eabb147` - [Jwie](mailto:joey.daman@twoup.eu)
* update `8b7c1c8` - [Peter Paulis](mailto:peterpaulis@Admins-MacBook-Air-2.local)
* Correct typo `f99215b` - [Ryan Maxwell](mailto:ryanm@xwell.co.nz)
* Update MR_SHORTHAND installation note to match main readme `222c956` - [Ryan Maxwell](mailto:ryanm@xwell.co.nz)
* Correct typo of "persistent" in method name `86db065` - [Ryan Maxwell](mailto:ryanm@xwell.co.nz)
* Make all requestAllSortedBy* methods consistent (allows sortTerms with commas) `33f3994` - [vguerci](mailto:vguerci@gmail.com)
* dispatch_release is not needed by the <REDACTED> compiler `7128091` - [Saul Mora](mailto:saul@magicalpanda.com)
* Don't run completion block if non specified `3aa2845` - [Saul Mora](mailto:saul@magicalpanda.com)
* Make platform requirements more explicit `acff79a` - [Saul Mora](mailto:saul@magicalpanda.com)
* Update MagicalRecord/Core/MagicalRecordShorthand.h `7daf3ad` - [Ryan Maxwell](mailto:ryanm@xwell.co.nz)
* Added automatic store deletion if the store does not match the model `b8326a6` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Missed the configuration `22fe81a` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Updating readme with a short blurb `d8394cf` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Cleanup code is now debug-only `45d764a` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Clarified the DEBUG only nature of the fix `8842d8f` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Making background save asynchronous and fix the callback not firing `22311b7` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Added expecta matchers for tests `cff0304` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Fixing formatting issues to match project style `3bc55de` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Fixed KVC relationship mapping bug. `eaa78c2` - [Joshua Greene](mailto:jrg.developer@gmail.com)
* Fixed an issue with aggregate actions not being performed in the specified context `9348ef5` - [Brian King](mailto:bking@agamatrix.com)
* Adding an observer to check for icloud being setup after default context has been set. Should fix race condition in Issue #241 `5341e84` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Updated test model to actually build `2df10b1` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Clean up comments `ef16c57` - [Saul Mora](mailto:saul@magicalpanda.com)
* Remove compile warnings `8f93070` - [Saul Mora](mailto:saul@magicalpanda.com)
* Cleaning up iCloud setup observer code some `32f9f80` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Removes dispatch_release when iOS >= 6 || OSX >= 1080 `28a864b` - [Rod Wilhelmy](mailto:rwilhelmy@gmail.com)
* Modifiying generateShorthand.rb to use user specified ruby `25081d0` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Automatically obtain permanent IDs when saving the default context. This should fix several crashes the community is hitting `0e34179` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Making all relevant contexts obtain a permanent id before saving `0b00e39` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Adding recommended journalling mode `a9a7643` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* fixup compiler warnings in Xcode 4.5 `5203cc1` - [Saul Mora](mailto:saul@magicalpanda.com)
* Fix compile warnings once and for all :/ `11e5ee1` - [Saul Mora](mailto:saul@magicalpanda.com)
* refactor internal method names to match more general objects to traverse fix another compile warning `0a6f523` - [Saul Mora](mailto:saul@magicalpanda.com)
* - auto-migration options bug fix `1924d73` - [Alexander Belyavskiy](mailto:diejmon@me.com)
* Don't adjust incoming NSDates for DST `da39710` - [Saul Mora](mailto:saul@magicalpanda.com)
* fix compile error with pragma option `51fe465` - [Saul Mora](mailto:saul@magicalpanda.com)
* Add findFirstOrderedByAttribute:ascending:context: method for getting min/max values easier `abb7314` - [Saul Mora](mailto:saul@magicalpanda.com)
* Bumping podspec to 2.0.4 `4091c78` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Added new nestedContextSave method with completion handler `2660e73` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Bumping podspec with bugfix `a451eb4` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Fixing rookie mistake :/ `72dc5a4` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Require ARC in podspec (was compiling with retain/release in pod installations) `48cc383` - [Ryan Maxwell](mailto:ryanm@xwell.co.nz)
* Bump tag to 2.0.6 `f2e2b7b` - [Ryan Maxwell](mailto:ryanm@xwell.co.nz)
* Properly removing existing on-save notificaitons before replacing the default or root contexts `343b027` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Fixing potential concurrency issue with creating the actionQueue `52139bd` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Cherry picking changes that make the context description more... descriptive `a41ceee` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* Rolled back a commit that broke things if cleanup was used. It created the action_queue in a dispatch_once block, and never recreated it after a cleanup `b81e70d` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
* saveWithBlock was not saving parent contexts `870ca22` - [Tony Arnold](mailto:tony@thecocoabots.com)
* Test that the current thread saveWith method actually saves `d41d744` - [Tony Arnold](mailto:tony@thecocoabots.com)
* Bumped podspec to 2.0.7 `601869e` - [Stephen Vanterpool](mailto:stephen@vanterpool.net)
4 changes: 2 additions & 2 deletions MagicalRecord.podspec
@@ -1,11 +1,11 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'MagicalRecord' s.name = 'MagicalRecord'
s.version = '2.0.7' s.version = '2.0.8'
s.license = 'MIT' s.license = 'MIT'
s.summary = 'Super Awesome Easy Fetching for Core Data 1!!!11!!!!1!.' s.summary = 'Super Awesome Easy Fetching for Core Data 1!!!11!!!!1!.'
s.homepage = 'http://github.com/magicalpanda/MagicalRecord' s.homepage = 'http://github.com/magicalpanda/MagicalRecord'
s.author = { 'Saul Mora' => 'saul@magicalpanda.com' } s.author = { 'Saul Mora' => 'saul@magicalpanda.com' }
s.source = { :git => 'https://github.com/magicalpanda/MagicalRecord.git', :tag => '2.0.7' } s.source = { :git => 'https://github.com/magicalpanda/MagicalRecord.git', :tag => '2.0.8' }
s.description = 'Handy fetching, threading and data import helpers to make Core Data a little easier to use.' s.description = 'Handy fetching, threading and data import helpers to make Core Data a little easier to use.'
s.source_files = 'MagicalRecord/**/*.{h,m}' s.source_files = 'MagicalRecord/**/*.{h,m}'
s.framework = 'CoreData' s.framework = 'CoreData'
Expand Down
Expand Up @@ -42,6 +42,9 @@


#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR


+ (NSFetchedResultsController *) MR_fetchAllWithDelegate:(id<NSFetchedResultsControllerDelegate>)delegate;
+ (NSFetchedResultsController *) MR_fetchAllWithDelegate:(id<NSFetchedResultsControllerDelegate>)delegate inContext:(NSManagedObjectContext *)context;

+ (NSFetchedResultsController *) MR_fetchAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending withPredicate:(NSPredicate *)searchTerm groupBy:(NSString *)groupingKeyPath delegate:(id<NSFetchedResultsControllerDelegate>)delegate; + (NSFetchedResultsController *) MR_fetchAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending withPredicate:(NSPredicate *)searchTerm groupBy:(NSString *)groupingKeyPath delegate:(id<NSFetchedResultsControllerDelegate>)delegate;
+ (NSFetchedResultsController *) MR_fetchAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending withPredicate:(NSPredicate *)searchTerm groupBy:(NSString *)groupingKeyPath delegate:(id<NSFetchedResultsControllerDelegate>)delegate inContext:(NSManagedObjectContext *)context; + (NSFetchedResultsController *) MR_fetchAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending withPredicate:(NSPredicate *)searchTerm groupBy:(NSString *)groupingKeyPath delegate:(id<NSFetchedResultsControllerDelegate>)delegate inContext:(NSManagedObjectContext *)context;


Expand Down
@@ -1,4 +1,4 @@
// //
// NSManagedObject+MagicalFinders.m // NSManagedObject+MagicalFinders.m
// Magical Record // Magical Record
// //
Expand Down Expand Up @@ -198,7 +198,7 @@ + (NSArray *) MR_findByAttribute:(NSString *)attribute withValue:(id)searchValue
NSPredicate *searchTerm = [NSPredicate predicateWithFormat:@"%K = %@", attribute, searchValue]; NSPredicate *searchTerm = [NSPredicate predicateWithFormat:@"%K = %@", attribute, searchValue];
NSFetchRequest *request = [self MR_requestAllSortedBy:sortTerm ascending:ascending withPredicate:searchTerm inContext:context]; NSFetchRequest *request = [self MR_requestAllSortedBy:sortTerm ascending:ascending withPredicate:searchTerm inContext:context];


return [self MR_executeFetchRequest:request]; return [self MR_executeFetchRequest:request inContext:context];
} }


+ (NSArray *) MR_findByAttribute:(NSString *)attribute withValue:(id)searchValue andOrderBy:(NSString *)sortTerm ascending:(BOOL)ascending + (NSArray *) MR_findByAttribute:(NSString *)attribute withValue:(id)searchValue andOrderBy:(NSString *)sortTerm ascending:(BOOL)ascending
Expand Down Expand Up @@ -231,6 +231,20 @@ + (NSFetchedResultsController *) MR_fetchController:(NSFetchRequest *)request de
return controller; return controller;
} }


+ (NSFetchedResultsController *) MR_fetchAllWithDelegate:(id<NSFetchedResultsControllerDelegate>)delegate;
{
return [self MR_fetchAllWithDelegate:delegate inContext:[NSManagedObjectContext MR_contextForCurrentThread]];
}

+ (NSFetchedResultsController *) MR_fetchAllWithDelegate:(id<NSFetchedResultsControllerDelegate>)delegate inContext:(NSManagedObjectContext *)context;
{
NSFetchRequest *request = [self MR_requestAllInContext:context];
NSFetchedResultsController *controller = [self MR_fetchController:request delegate:delegate useFileCache:NO groupedBy:nil inContext:context];

[self MR_performFetch:controller];
return controller;
}

+ (NSFetchedResultsController *) MR_fetchAllGroupedBy:(NSString *)group withPredicate:(NSPredicate *)searchTerm sortedBy:(NSString *)sortTerm ascending:(BOOL)ascending delegate:(id<NSFetchedResultsControllerDelegate>)delegate inContext:(NSManagedObjectContext *)context + (NSFetchedResultsController *) MR_fetchAllGroupedBy:(NSString *)group withPredicate:(NSPredicate *)searchTerm sortedBy:(NSString *)sortTerm ascending:(BOOL)ascending delegate:(id<NSFetchedResultsControllerDelegate>)delegate inContext:(NSManagedObjectContext *)context
{ {
NSFetchRequest *request = [self MR_requestAllSortedBy:sortTerm NSFetchRequest *request = [self MR_requestAllSortedBy:sortTerm
Expand Down
Expand Up @@ -92,10 +92,10 @@ + (NSFetchRequest *) MR_requestFirstByAttribute:(NSString *)attribute withValue:


+ (NSFetchRequest *) MR_requestAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending inContext:(NSManagedObjectContext *)context + (NSFetchRequest *) MR_requestAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending inContext:(NSManagedObjectContext *)context
{ {
return [self MR_requestAllSortedBy:sortTerm return [self MR_requestAllSortedBy:sortTerm
ascending:ascending ascending:ascending
withPredicate:nil withPredicate:nil
inContext:[NSManagedObjectContext MR_contextForCurrentThread]]; inContext:context];
} }


+ (NSFetchRequest *) MR_requestAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending + (NSFetchRequest *) MR_requestAllSortedBy:(NSString *)sortTerm ascending:(BOOL)ascending
Expand Down
Expand Up @@ -23,8 +23,8 @@ extern NSString * const kMagicalRecordDidMergeChangesFromiCloudNotification;
+ (NSManagedObjectContext *) MR_defaultContext; + (NSManagedObjectContext *) MR_defaultContext;


- (NSString *) MR_description; - (NSString *) MR_description;
- (NSString *) MR_parentChain;


- (void) MR_setContextWorkingName:(NSString *)workingName; @property (nonatomic, copy, setter = MR_setWorkingName:) NSString *MR_workingName;
- (NSString *) MR_contextWorkingName;


@end @end
Expand Up @@ -12,7 +12,7 @@
static NSManagedObjectContext *defaultManagedObjectContext_ = nil; static NSManagedObjectContext *defaultManagedObjectContext_ = nil;
static id iCloudSetupNotificationObserver = nil; static id iCloudSetupNotificationObserver = nil;


#define kNSManagedObjectContextWorkingName @"kNSManagedObjectContextWorkingName" static NSString * const kMagicalRecordNSManagedObjectContextWorkingName = @"kNSManagedObjectContextWorkingName";


@interface NSManagedObjectContext (MagicalRecordInternal) @interface NSManagedObjectContext (MagicalRecordInternal)


Expand All @@ -34,19 +34,23 @@ + (void) MR_cleanUp;


- (NSString *) MR_description; - (NSString *) MR_description;
{ {
NSString *contextName = (self == defaultManagedObjectContext_) ? @"*** DEFAULT ***" : @""; NSString *contextLabel = [NSString stringWithFormat:@"*** %@ ***", [self MR_workingName]];
contextName = (self == rootSavingContext) ? @"*** BACKGROUND SAVE ***" : contextName; NSString *onMainThread = [NSThread isMainThread] ? @"*** MAIN THREAD ***" : @"*** BACKGROUND THREAD ***";


NSString *onMainThread = [NSThread isMainThread] ? @"*** MAIN THREAD ***" : @"*** SECONDARY THREAD ***"; return [NSString stringWithFormat:@"<%@ (%p): %@> on %@", NSStringFromClass([self class]), self, contextLabel, onMainThread];

}
NSString *familyTree = [NSString string];
NSManagedObjectContext *parentContext = [self parentContext]; - (NSString *) MR_parentChain;
while (nil != parentContext) { {
familyTree = [familyTree stringByAppendingFormat:@" ==> %@;",[parentContext MR_contextWorkingName]]; NSMutableString *familyTree = [@"" mutableCopy];
parentContext = [parentContext parentContext]; NSManagedObjectContext *currentContext = self;
do
{
[familyTree appendFormat:@"- %@ (%p) %@\n", [currentContext MR_workingName], currentContext, (currentContext == self ? @"(*)" : @"")];
} }
while ((currentContext = [currentContext parentContext]));


return [NSString stringWithFormat:@"%@: %@ Context %@ \nFamilyTree: %@", [self MR_contextWorkingName], contextName, onMainThread,familyTree]; return [NSString stringWithString:familyTree];
} }


+ (NSManagedObjectContext *) MR_defaultContext + (NSManagedObjectContext *) MR_defaultContext
Expand All @@ -66,7 +70,8 @@ + (void) MR_setDefaultContext:(NSManagedObjectContext *)moc
} }


NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_defaultStoreCoordinator]; NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_defaultStoreCoordinator];
if (iCloudSetupNotificationObserver) { if (iCloudSetupNotificationObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:iCloudSetupNotificationObserver]; [[NSNotificationCenter defaultCenter] removeObserver:iCloudSetupNotificationObserver];
iCloudSetupNotificationObserver = nil; iCloudSetupNotificationObserver = nil;
} }
Expand All @@ -77,8 +82,10 @@ + (void) MR_setDefaultContext:(NSManagedObjectContext *)moc
} }


defaultManagedObjectContext_ = moc; defaultManagedObjectContext_ = moc;
[moc MR_obtainPermanentIDsBeforeSaving]; [defaultManagedObjectContext_ MR_setWorkingName:@"DEFAULT"];
if ([MagicalRecord isICloudEnabled])
// [moc MR_obtainPermanentIDsBeforeSaving];
if ([MagicalRecord isICloudEnabled])
{ {
[defaultManagedObjectContext_ MR_observeiCloudChangesInCoordinator:coordinator]; [defaultManagedObjectContext_ MR_observeiCloudChangesInCoordinator:coordinator];
} }
Expand All @@ -92,6 +99,7 @@ + (void) MR_setDefaultContext:(NSManagedObjectContext *)moc
[[NSManagedObjectContext MR_defaultContext] MR_observeiCloudChangesInCoordinator:coordinator]; [[NSManagedObjectContext MR_defaultContext] MR_observeiCloudChangesInCoordinator:coordinator];
}]; }];
} }
MRLog(@"Set Default Context: %@", defaultManagedObjectContext_);
} }


+ (NSManagedObjectContext *) MR_rootSavingContext; + (NSManagedObjectContext *) MR_rootSavingContext;
Expand All @@ -107,24 +115,23 @@ + (void) MR_setRootSavingContext:(NSManagedObjectContext *)context;
} }


rootSavingContext = context; rootSavingContext = context;
[context MR_obtainPermanentIDsBeforeSaving]; // [context MR_obtainPermanentIDsBeforeSaving];
[rootSavingContext setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy]; [rootSavingContext setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy];
[rootSavingContext MR_setContextWorkingName:@"rootSavingsContext"]; [rootSavingContext MR_setWorkingName:@"BACKGROUND SAVING (ROOT)"];
MRLog(@"Set Root Saving Context: %@", rootSavingContext);
} }


+ (void) MR_initializeDefaultContextWithCoordinator:(NSPersistentStoreCoordinator *)coordinator; + (void) MR_initializeDefaultContextWithCoordinator:(NSPersistentStoreCoordinator *)coordinator;
{ {
if (defaultManagedObjectContext_ == nil) if (defaultManagedObjectContext_ == nil)
{ {
NSManagedObjectContext *rootContext = [self MR_contextWithStoreCoordinator:coordinator]; NSManagedObjectContext *rootContext = [self MR_contextWithStoreCoordinator:coordinator];

[self MR_setRootSavingContext:rootContext]; [self MR_setRootSavingContext:rootContext];


NSManagedObjectContext *defaultContext = [self MR_newMainQueueContext]; NSManagedObjectContext *defaultContext = [self MR_newMainQueueContext];
[defaultContext MR_setContextWorkingName:@"defaultContext"];
[defaultContext setParentContext:rootSavingContext];

[self MR_setDefaultContext:defaultContext]; [self MR_setDefaultContext:defaultContext];

[defaultContext setParentContext:rootSavingContext];
} }
} }


Expand Down Expand Up @@ -154,13 +161,14 @@ + (NSManagedObjectContext *) MR_contextWithParent:(NSManagedObjectContext *)pare
{ {
NSManagedObjectContext *context = [self MR_contextWithoutParent]; NSManagedObjectContext *context = [self MR_contextWithoutParent];
[context setParentContext:parentContext]; [context setParentContext:parentContext];
[context MR_obtainPermanentIDsBeforeSaving]; // [context MR_obtainPermanentIDsBeforeSaving];
return context; return context;
} }


+ (NSManagedObjectContext *) MR_newMainQueueContext; + (NSManagedObjectContext *) MR_newMainQueueContext;
{ {
NSManagedObjectContext *context = [[self alloc] initWithConcurrencyType:NSMainQueueConcurrencyType]; NSManagedObjectContext *context = [[self alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
MRLog(@"Created Main Queue Context: %@", context);
return context; return context;
} }


Expand All @@ -182,35 +190,39 @@ + (NSManagedObjectContext *) MR_contextWithStoreCoordinator:(NSPersistentStoreCo
- (void) MR_obtainPermanentIDsBeforeSaving; - (void) MR_obtainPermanentIDsBeforeSaving;
{ {
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(contextWillSave:) selector:@selector(MR_contextWillSave:)
name:NSManagedObjectContextWillSaveNotification name:NSManagedObjectContextWillSaveNotification
object:self]; object:self];
} }


- (void)contextWillSave:(NSNotification *)notification - (void) MR_contextWillSave:(NSNotification *)notification
{ {
NSManagedObjectContext *context = (NSManagedObjectContext *)notification.object; NSManagedObjectContext *context = [notification object];
if (context.insertedObjects.count > 0) { NSSet *insertedObjects = [context insertedObjects];
NSArray *insertedObjects = [[context insertedObjects] allObjects];
MRLog(@"Context %@ is about to save. Obtaining permanent IDs for new %lu inserted objects", [context MR_description], (unsigned long)[insertedObjects count]); if ([insertedObjects count])
{
MRLog(@"Context %@ is about to save. Obtaining permanent IDs for new %lu inserted objects", [context MR_workingName], (unsigned long)[insertedObjects count]);
NSError *error = nil; NSError *error = nil;
BOOL success = [context obtainPermanentIDsForObjects:insertedObjects error:&error]; BOOL success = [context obtainPermanentIDsForObjects:[insertedObjects allObjects] error:&error];
if (!success && error) { if (!success)
{
[MagicalRecord handleErrors:error]; [MagicalRecord handleErrors:error];
} }
} }
} }


- (void) MR_setContextWorkingName:(NSString *)workingName; - (void) MR_setWorkingName:(NSString *)workingName;
{ {
[[self userInfo] setObject:workingName forKey:kNSManagedObjectContextWorkingName]; [[self userInfo] setObject:workingName forKey:kMagicalRecordNSManagedObjectContextWorkingName];
} }


- (NSString *) MR_contextWorkingName; - (NSString *) MR_workingName;
{ {
NSString *workingName = [[self userInfo] objectForKey:kNSManagedObjectContextWorkingName]; NSString *workingName = [[self userInfo] objectForKey:kMagicalRecordNSManagedObjectContextWorkingName];
if (nil == workingName) { if (nil == workingName)
workingName = @"UndefinedWorkingContext"; {
workingName = @"UNNAMED";
} }
return workingName; return workingName;
} }
Expand Down
Expand Up @@ -11,7 +11,7 @@
@interface NSManagedObjectContext (MagicalSaves) @interface NSManagedObjectContext (MagicalSaves)


- (void) MR_save; - (void) MR_save;
- (void) MR_saveErrorHandler:(void (^)(NSError *))errorCallback; - (void) MR_saveWithErrorCallback:(void(^)(NSError *))errorCallback;


- (void) MR_saveInBackgroundCompletion:(void (^)(void))completion; - (void) MR_saveInBackgroundCompletion:(void (^)(void))completion;
- (void) MR_saveInBackgroundErrorHandler:(void (^)(NSError *))errorCallback; - (void) MR_saveInBackgroundErrorHandler:(void (^)(NSError *))errorCallback;
Expand Down

0 comments on commit 8861927

Please sign in to comment.