I do not know if this is the reason, but after you set
__managedObjectContext = nil;
__persistentStoreCoordinator = nil;
you call
if ([[self.managedObjectContext persistentStoreCoordinator] removePersistentStore: [[[self.managedObjectContext persistentStoreCoordinator] persistentStores] lastObject] error:&error])
so if you have getter methods (as default xcode creates them) you initialize them again, if not then you call methods on nil objects.
Edit: trying to explain (better)
After you set
__managedObjectContext = nil;
you call
[self.managedObjectContext persistentStoreCoordinator]
which means
[nil persistentStoreCoordinator]
unless you have
- (NSManagedObjectContext *)managedObjectContext
method in the class. if you have the method it creates managedObjectContext for the same(old) data model again.
So if you want to create new coordinator, context... with new model file, then you need to set them nil after you remove the old file.