Advertisement
Guest User

Untitled

a guest
May 29th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #import "SMDocument.h"
  2.  
  3. @implementation SMDocument
  4.  
  5. - (id)init {
  6. self = [super init];
  7. if (self) {
  8. NSManagedObjectContext *context = self.managedObjectContext;
  9. if (context.concurrencyType != NSMainQueueConcurrencyType) {
  10. NSUndoManager *undoManager = context.undoManager;
  11. NSPersistentStoreCoordinator *coordinator = context.persistentStoreCoordinator;
  12. context = [NSManagedObjectContext newMainQueueContext];
  13. context.persistentStoreCoordinator = coordinator;
  14. context.undoManager = undoManager;
  15. self.managedObjectContext = context;
  16. }
  17.  
  18. NSAssert1(self.managedObjectContext.concurrencyType == NSMainQueueConcurrencyType, @"Wrong concurrency type: %li", self.managedObjectContext.concurrencyType);
  19. }
  20. return self;
  21. }
  22.  
  23. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement