나는 클라우드의 문서 작업 중입니다 ... * 클라우드에 문서 추가 * 클라우드에서 해당 문서 삭제 * 몇 초 후에 그 문서가 다시 나타납니다. 이처럼 보이는 지금삭제 된 UIDocument가 구름에서 다시 나타납니다.
NSURL* fileURL = self.currentdocument.fileURL;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) {
NSFileCoordinator* fileCoordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil];
NSError* error = nil;
[fileCoordinator coordinateWritingItemAtURL:fileURL options:NSFileCoordinatorWritingForDeleting error:&error byAccessor:^(NSURL* writingURL) {
if (error != nil) {
DLog(@"Error with %@! %@", fileURL, error);
return;
}
DLog(@"Got writingURL: %@", writingURL);
NSFileManager* fileManager = [[NSFileManager alloc] init];
if ([fileManager removeItemAtURL:writingURL error:nil]) {
DLog(@"Deleted %@!", writingURL);
}
else {
DLog(@"ERROR Failed deleting %@!", self.currentdocument);
}
[fileManager release];
[fileCoordinator release];
}];
});
을 위하고에도 불구하고 :이처럼 나중에 삭제 그런 다음이
NSURL *ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];
NSURL *ubiquitousPackage = [[ubiq URLByAppendingPathComponent:@"Documents"] URLByAppendingPathComponent:@"somenewfilename"];
MyDoc* docTemp = [[MyDoc alloc] initWithFileURL:ubiquitousPackage];
docTemp.mapContent = [NSString stringWithString:self.currentdocument.mapContent];
[docTemp saveToURL:[docTemp fileURL]
forSaveOperation:UIDocumentSaveForCreating
completionHandler:^(BOOL success) {
if (success) {
DLog(@"New document %@ saved/added: %@", newFilename, docTemp);
}
else {
DLog(@"Failed saving new document: %@", newFilename);
}
[docTemp release];
}];
같은 UIDocument의 인스턴스를 생성
: 여기
은 세부 사항입니다 파일은 (잠시) 동안 삭제되지만 여러 번 삭제 된 문서가 1 ~ 2 초 후에 클라우드에 다시 나타납니다. (다른 장치의 iCloud 설정을 통해 또는 업데이트 알림을 보내는 쿼리를 통해 확인할 수 있습니다.) 일부 경우에만 파일이 삭제 된 채로 남아 있습니다. 무슨 일이야?설정 -> iCloud에서 파일을 삭제해도 위의 패턴이 발생합니다. 이 파일은 몇 초 후 마술처럼 다시 나타납니다. 타이밍 문제? 동기화 문제가 있습니까?
해결 방법을 찾으셨습니까? – Bongeh
내 문제는 필자가 항상 모든 문서를 내 목록에 보관한다는 것입니다 (클라우드의 모든 문서와 인터페이스가 있습니다 ...). 아, 긴 편집자 인터페이스 또는 이와 비슷한 종류의 파일을 열지 않으면 파일을 열어 두지 않아도됩니다. 문서가 열려있는 한 삭제하는 것이 의미가 없을 것입니다. 사용자가 앱을 탭했을 때만 내 앱을 열어서 변경했습니다. 나는 이것이 나의 문제를 해결했다고 생각한다. – Jonny
오케이, 고마워, 내 문서가 할당 취소되지 않는 이유를 알아내는 데 도움이 될 수 있습니다! 어쩌면 내가 그들을 닫을 필요가있다 : – Bongeh