diff --git a/platform-darwin/Source/MPAppDelegate_Store.m b/platform-darwin/Source/MPAppDelegate_Store.m index 25cf8f95..f71e3942 100644 --- a/platform-darwin/Source/MPAppDelegate_Store.m +++ b/platform-darwin/Source/MPAppDelegate_Store.m @@ -51,6 +51,8 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted ); + (NSManagedObjectContext *)managedObjectContextForMainThreadIfReady { + NSAssert( [[NSThread currentThread] isMainThread], @"Direct access to main MOC only allowed from the main thread." ); + NSManagedObjectContext *mainManagedObjectContext = [[self get] mainManagedObjectContextIfReady]; if (!mainManagedObjectContext || ![[NSThread currentThread] isMainThread]) return nil; @@ -154,8 +156,6 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted ); - (NSManagedObjectContext *)mainManagedObjectContextIfReady { - NSAssert( [[NSThread currentThread] isMainThread], @"Can only access main MOC from the main thread." ); - [self loadStore]; if (!self.mainManagedObjectContext && self.privateManagedObjectContext.persistentStoreCoordinator) {