아이폰 OS iCloud에NSInternalInconsistencyException NSInternalInconsistencyException (SQL 문자열의 실행 중에 오류 '로 인해 캐치되지 않는 예외에
응용 프로그램을 종료 Y_UBMETA (YPEERID, YTRANSACTIONNUMBER) INTO INSERT)' '이유 :'SQL 문자열의 실행 중에 오류 'Y_UBMETA INTO INSERT (YPEERID, YTRANSACTIONNUMBER)
오류 도메인 = NSCocoaErrorDomain Code = 134312 "메타 데이터 복구 저장에 실패했습니다. 다시 코디네이터에 저장소를 추가하십시오. 성공적으로 수행되지 않으면 데이터를 새로운 유비쿼터스 영구 노드로 마이그레이션하십시오. 저장." UserInfo = 0xdba5b80 {NSLocalizedDescription = 메타 데이터 복구 저장에 실패했습니다. 저장소를 코디네이터에 다시 추가하십시오. 성공적으로 수행되지 않으면 데이터를 새로운 유비쿼터스 영구 저장소로 마이그레이션하십시오.}, { NSLocalizedDescription = "메타 데이터 복구 저장에 실패했습니다. 저장소를 다시 코디네이터에 추가하십시오. 실패하면 데이터를 다음 위치로 마이그레이션하십시오. 새로운 유비쿼터스 영구 저장소. ";
어떻게이 문제를 해결할 수 있습니까? 그것이 iCloud에 대한 내부 쿼리라는 사실을 알려주십시오. 내가하지 코드에 의해 내 응용 프로그램에서, 엑스 코드에서 데이터 모델의 속성을 변경 되었기 때문에 나는이 같은 문제를 가지고있다
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
NSLog(@"persistentStoreCoordinator:%@",[persistentStoreCoordinator_ description]);
if((persistentStoreCoordinator_ != nil))
{
return persistentStoreCoordinator_;
}
NSLog(@"persistentStoreCoordinator:%@",[persistentStoreCoordinator_ description]);
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"CoreDataModel.sqlite"];
persistentStoreCoordinator_ = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
NSPersistentStoreCoordinator* psc = persistentStoreCoordinator_;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSFileManager *fileManager = [NSFileManager defaultManager];
// Migrate datamodel
NSDictionary *options = nil;
// this needs to match the entitlements and provisioning profile
NSURL *cloudURL = [fileManager URLForUbiquityContainerIdentifier:nil];
NSLog(@"cloudURL:%@",cloudURL);
//NSString* coreDataCloudContent = [[cloudURL path] stringByAppendingPathComponent:@"Data"];
cloudURL = [cloudURL URLByAppendingPathComponent:@"Data"];
// NSLog(@"coreDataCloudContent:%@",coreDataCloudContent);
//if ([coreDataCloudContent length] != 0 && [[defaults objectForKey:@"allMetadataFlag"] isEqualToString:@"YES"])
if (cloudURL)//&& [[defaults objectForKey:@"allMetadataFlag"] isEqualToString:@"YES"])
{
// iCloud is available
// cloudURL = [NSURL fileURLWithPath:coreDataCloudContent];
NSLog(@"cloudURL:%@",cloudURL);
options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption,
@"SecureAssistant.store", NSPersistentStoreUbiquitousContentNameKey,
cloudURL, NSPersistentStoreUbiquitousContentURLKey,nil];
}
else
{
// iCloud is not available
options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption,nil];
}
NSError *error = nil;
[psc lock];
if (![psc addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error])
{
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
[psc unlock];
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"asynchronously added persistent store!");
[[NSNotificationCenter defaultCenter] postNotificationName:@"RefetchAllDatabaseData" object:self userInfo:nil];
});
});
return persistentStoreCoordinator_;
}