더 많은 iCloud Core 데이터 동기화 문제
그래서 종료습니다. 독립 iPhone 개발자에게 최악의 시나리오가 발생했습니다. user-가 여러 내 앱을 업그레이드 한 후 완전한 데이터 손실 을 보고 합니다. iCloud Core 데이터 동기화가 작동하지 않습니다. 내 사용자는이 앱을 부분적으로 사용하여 비즈니스를 운영하고 있습니다. 이것은 참으로 치명적인 실패 입니다.
내가 변경 한 유일한 iCloud 관련 사항은 iCloud에 키-값 저장소를 추가하는 것입니다. 핵심 데이터 코드는 정확히 동일하고 동일한 모델 버전 (마이그레이션 없음) 등으로 유지되었습니다.
내 테스트에서 모든 것이 아름답게 작동했습니다! 그러나 실망스럽게도 사용자는 업데이트 된 앱을 열었을 때 더 이상 데이터가 있고보고되었습니다.
그 이유는 무엇일까요?
- 영구 저장소의 URL (유비쿼터스 URL)을 변경 대상 안된다.
- 이 문제는 발생하기 전에 업데이트 발생 문제를 병합 하지 않습니다.
-
새로운 유비쿼터스 키-값 저장소에약간의 무릎이있습니까?
(나는 거의 배제했습니다.)
아래에서 내 관리 개체 모델 및 영구 저장소에 대한 코드를 찾으십시오. 문제를 평가하기 위해 다른 것이 필요하면 알려주십시오.
- (NSManagedObjectContext *)managedObjectContext {
if (managedObjectContext_ != nil) {
return managedObjectContext_;
}
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
if (coordinator != nil) {
managedObjectContext_ = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
[managedObjectContext_ performBlockAndWait:^{
[managedObjectContext_ setPersistentStoreCoordinator:coordinator];
if (useICloud) {
[managedObjectContext_ setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(mergeiCloud:)
name:NSPersistentStoreDidImportUbiquitousContentChangesNotification
object:coordinator];
}
}];
}
return managedObjectContext_;
}
과
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
if (persistentStoreCoordinator_ != nil) {
return persistentStoreCoordinator_;
}
NSMutableDictionary *options = [NSMutableDictionary dictionary];
NSURL *storeURL = [[self applicationDocumentsDirectory]
URLByAppendingPathComponent:@"SalesCalls.sqlite"];
[options setObject:[NSNumber numberWithBool:YES]
forKey:NSMigratePersistentStoresAutomaticallyOption];
[options setObject:[NSNumber numberWithBool:YES]
forKey:NSInferMappingModelAutomaticallyOption];
if (useICloud) { // this is an internal flag set to YES
NSURL *iCloudURL = [[NSFileManager defaultManager]
URLForUbiquityContainerIdentifier:nil];
if (nil!=iCloudURL) {
NSString *cloudData = [[iCloudURL path]
stringByAppendingPathComponent:@"data"];
iCloudURL = [NSURL fileURLWithPath:cloudData];
[options setObject:@"at.topofmind.salesplus.store"
forKey:NSPersistentStoreUbiquitousContentNameKey];
[options setObject:iCloudURL
forKey:NSPersistentStoreUbiquitousContentURLKey];
NSURL *nosyncDir = [iCloudURL
URLByAppendingPathComponent:@"data.nosync"];
[[NSFileManager defaultManager] createDirectoryAtURL:nosyncDir
withIntermediateDirectories:YES
attributes:nil error:nil];
storeURL = [nosyncDir
URLByAppendingPathComponent:@"SalesCalls.sqlite"];
}
}
NSError *error = nil;
persistentStoreCoordinator_ = [[NSPersistentStoreCoordinator alloc]
initWithManagedObjectModel:[self managedObjectModel]];
if (![persistentStoreCoordinator_
addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil URL:storeURL options:options error:&error])
{
NSLog(@"Cannot create persistent store coordinator, %@, %@",
error, [error userInfo]);
abort();
}
return persistentStoreCoordinator_;
}
의견, 의견, 추측 등 (물론 해결 방법도 있습니다!).
최신 정보 :
내 고객 중 한 명이 모든 데이터를 잃어버린 모든 것을 갖추고 있고 한 후 (기기 등) 더 이상 iCloud와 동기화 할 수 없습니다. 기호는 설정에 표시되지 않습니다.
나는 거의 사용하지 않고 비슷한 것을 직면하고있었습니다 (당신의 설명에 따르면 나는 당신이 나보다 훨씬 더 많은 양을 가지고 있다고 가정했습니다. 그것이 여러 경우의 이유 일 수 있습니다)
제 경우에는 Apple이 icloud의 20GB 여유 공간을 사전 통지없이 제거 한 것처럼 보였습니다. 전력 데이터 사용 사용자 인 두 가지 용도가 내 앱 (과거 주가를 처리하기위한)에서 새 데이터를 잃어 버렸고 다른 용도에서는 동일한 데이터 크기를 잘 다운로드하는 것으로 나타났습니다.
나는 그 2를 추적하여 icloud와 voila에 더 많은 공간을 확보하기 위해 물건을 정리하도록 돕고 데이터를 다시 다운로드 한 후 정상적으로 작동했습니다.
참고 URL : https://stackoverflow.com/questions/14478517/more-icloud-core-data-synching-woes
'ProgramingTip' 카테고리의 다른 글
구체적인 구현이있는 추상 클래스를 스텁하지 않도록 Pex에 지시하는 방법 (0) | 2020.12.09 |
---|---|
경고 : Visual Paradigm에서 코드 생성에 사용할 수있는 클래스 모델이 없습니다. (0) | 2020.12.09 |
검색 릭 링크를 찾는 방법은 무엇입니까? (0) | 2020.12.08 |
fetch (key) 오류 : 지연로드 데이터베이스 (0) | 2020.12.08 |
"예외를 사용하지 않는"캠프에있는 경우 표준 라이브러리를 어떻게 사용합니까? (0) | 2020.12.08 |