2 개의 CoreData 데이터베이스로 마이그레이션을 수행하고 싶습니다. 나는 apple developer document을 읽었다.마이그레이션 핵심 데이터 오류 코드 134130
첫 번째 데이터베이스의 경우 새 버전의 데이터베이스에 몇 가지 특성 (문자열, 정수 및 날짜 속성)을 추가했습니다. 모든 단계를 거친 후 처음으로 마이그레이션을 성공적으로 마쳤습니다.
두 번째 데이터베이스에서 새로운 버전의 데이터베이스에 특성 (문자열, 정수, 날짜, 변환 가능 및 이진 데이터 속성)을 추가했습니다. 그리고 첫 번째 데이터베이스와 같이 모든 단계를 수행하면 시스템에서 오류를 반환합니다 (134130).
if (persistentStoreCoordinator_) {
PMReleaseSafely(persistentStoreCoordinator_);
}
// Notify
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName:GCalWillMigrationNotification object:self];
//
NSString *sourceStoreType = NSSQLiteStoreType;
NSString *dataStorePath = [PMUtility dataStorePathForName:GCalDBWarehousePersistentStoreName];
NSURL *storeURL = [NSURL fileURLWithPath:dataStorePath];
BOOL storeExists = [[NSFileManager defaultManager] fileExistsAtPath:dataStorePath];
//
NSError *error = nil;
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
persistentStoreCoordinator_ = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:self.managedObjectModel];
[persistentStoreCoordinator_ addPersistentStoreWithType:sourceStoreType
configuration:nil
URL:storeURL
options:options
error:&error];
if (error != nil) {
abort();
}
오류가 nil이 아닌 아래 로그입니다 : 여기
코드입니다Error Domain=NSCocoaErrorDomain Code=134130 "The operation couldn\u2019t be completed. (Cocoa error 134130.)" UserInfo=0x856f790 {URL=file://localhost/Users/greensun/Library/Application%20Support/iPhone%20Simulator/5.0/Applications/D10712DE-D9FE-411A-8182-C4F58C60EC6D/Library/Application%20Support/XXX/XXX.sqlite, metadata={type = immutable dict, count = 7, entries => 2 : {contents = "NSStoreModelVersionIdentifiers"} = {type = immutable, count = 1, values = ( 0 : {contents = ""})} 4 : {contents = "NSPersistenceFrameworkVersion"} = {value = +386, type = kCFNumberSInt64Type} 6 : {contents = "NSStoreModelVersionHashes"} = {type = immutable dict, count = 2, entries => 0 : {contents = "XXX"} = {length = 32, capacity = 32, bytes = 0xfdae355f55c13fbd0344415fea26c8bb ... 4c1721aadd4122aa} 1 : {contents = "XXX"} = {length = 32, capacity = 32, bytes = 0x7676888f0d7eaff4d1f844343028ce02 ... 040af6cbe8c5fd01} } 7 : {contents = "NSStoreUUID"} = {contents = "51678BAC-CCFB-4D00-AF5C-8FA1BEDA6440"} 8 : {contents = "NSStoreType"} = {contents = "SQLite"} 9 : {contents = "_NSAutoVacuumLevel"} = {contents = "2"} 10 : {contents = "NSStoreModelVersionHashesVersion"} = {value = +3, type = kCFNumberSInt32Type} }, reason=Can't find model for source store}
내가 솔루션을 많이했지만, 그것은 작동하지 않습니다. 두 개의 새 버전 데이터베이스에 특성을 추가하고 한 번 마이그레이션하는 데 성공합니다.
답장을 보내 주셔서 감사합니다. – magichero
나는 내 문제를 해결했다. SVN으로 작업 해 왔으며 Core Date의 새 버전을 만들 때 SVN은 이전 버전 데이터의 사본을 만들었습니다. 프로젝트의 SVN에서 전체 핵심 데이터를 제거하고 외부 복사본을 만들어야합니다. 그런 다음 새 핵심 데이터를 작성하고 문제를 해결했습니다. – magichero