The data model for my application based on the main document (only for 10.5) is in, so the automatic updating of the scheme using the master data mapping model does not work. It seems that the Core Data equipment does not find suitable data models or matching models when they are not included in the main application package. Thus, instead of using automatic migration, I perform manual migration configurePersistentStoreCoordinatorForURL:ofType:... in my Subclass NSPersistenDocument (code below). I am moving the persistent save to a temporary file and then overwrite the existing file if the migration is successful. Then, an error occurs in the document with the message "This document file has been modified by another application since you opened or saved it." When I try to save. the list indicated, this is due to my modification of the document file "behind him." I tried updating the document file modification date, as shown below, but then I get an error dialog box with the message "Document location" test.ovproj "cannot be determined." When I try to save, I'm less sure about the reason for this error, but trading one unnecessary message (in this case) for another is not quite what I was going to.
Can anyone offer some kind of guidance? Is there a way to manually update the schema for a persistent document store without running one of these (in this case, unnecessary) warnings?
The code for updating the data warehouse in my subclasses is -configurePersistentStoreCoordinatorForURL:ofType:... :
if(upgradeNeeded) { NSManagedObjectModel *sourceModel = [NSManagedObjectModel mergedModelFromBundles:VUIModelBundles() orStoreMetadata:meta]; if(sourceModel == nil) { *error = [NSError errorWithDomain:VUIErrorDomainn ode:VUICoreDataErrorCode localizedReason:BWLocalizedString(@"Unable to find original data model for project.")]; return NO; } NSManagedObjectModel *destinationModel = [self managedObjectModel]; NSMigrationManager *migrationManager = [[NSMigrationManager alloc] initWithSourceModel:sourceModel destinationModel:destinationModel]; NSMappingModel *mappingModel = [NSMappingModel mappingModelFromBundles:VUIModelBundles() forSourceModel:sourceModel destinationModel:destinationModel]; if(mappingModel == nil) { *error = [NSError errorWithDomain:VUIErrorDomain code:VUICoreDataErrorCode localizedReason:BWLocalizedString(@"Unable to find mapping model to convert project to most recent project format.")]; return NO; } @try {
source share