UIManagedDocument
을 사용하여 iCloud에서 파일을 관리하고 있습니다. 설정 후에는 NSMetadataQuery
과 같이 :NSMetadataQuery가 사용자 정의 파일 패키지 유형을 무시합니다.
iCloudQuery = [[NSMetadataQuery alloc] init];
[iCloudQuery setSearchScopes:
[NSArray arrayWithObject:NSMetadataQueryUbiquitousDocumentsScope]];
[iCloudQuery setPredicate:
[NSPredicate predicateWithFormat:@"%K like %@", NSMetadataItemFSNameKey, @"DocumentMetadata.plist"]];
나는 호기심이 문제가 발생한 해요 - 내 문서 파일 확장자없이 지정된 경우에 또는 .txt
같은 공공 확장 (예 @"NewDocument2"
을 위해), 메타 데이터 쿼리가 제대로 발견 DocumentMetadata.plist
파일. 그러나 내 사용자 지정 파일 확장명을 사용할 때 쿼리는 아무 것도 찾지 못합니다. 쿼리가 시작될 때나 새 문서를 추가 할 때가 아닙니다.
내게는 사용자 지정 파일 확장명으로 내 문서를 볼 수 있는데 실제로 디렉터리 (파일 패키지)이 아니기 때문에 보이지 않습니다. 안에있는 DocumentMetadata.plist
파일을 찾으십시오. 그러나 앱의 info.plist
에서 맞춤식 UTI를 선언했습니다.
아마도 UTI를 잘못 선언 한 것일까 요? 나는 애플의 가이드 라인 (Document-Based App Programming Guide for iOS과 Uniform Type Identifiers Overview)을 따라 그것을 만들었지 만, 뭔가 잘못된 것처럼 보인다.
편집 : info.plist
에서 '수출 요로 감염'에서, 내 타입은 'com.apple.package'을 준수하도록 설정되어 있습니다.
편집 : 나는 여전히이 문제와 사투를 벌인거야. 나는 지금 파일 확장자를 사용하지 않음으로써 그것을 해결하려고 노력 중이다.
사용자 지정 파일 확장명을 사용할 때 iCloud 메타 데이터 쿼리 결과를 처리하고 DocumentMetadata.plist
파일이 파일 패키지 내에 있지만 메타 데이터 쿼리에서 볼 수 없습니다. 쿼리 결과를 열거하면 다음이 로그에 인쇄되어 있습니다 :
<iCloud Container URL>/Documents/
<iCloud Container URL>/Documents/New%20Document.spdoc/
<iCloud Container URL>/Documents/New%20Document.spdoc/DocumentMetadata.plist
<iCloud Container URL>/Documents/New%20Document.spdoc/StoreContent.nosync/
<iCloud Container URL>/Documents/New%20Document.spdoc/StoreContent.nosync/(A%20Document%20Being%20Saved%20By%20<AppName>%202)/
<iCloud Container URL>/Documents/New%20Document.spdoc/StoreContent.nosync/(A%20Document%20Being%20Saved%20By%20<AppName>)/
<iCloud Container URL>/Documents/New%20Document.spdoc/StoreContent.nosync/.persistentStore_SUPPORT/
<iCloud Container URL>/Documents/New%20Document.spdoc/StoreContent.nosync/.persistentStore_SUPPORT/_EXTERNAL_DATA/
<iCloud Container URL>/Documents/New%20Document.spdoc/StoreContent.nosync/persistentStore
은 (또한 "CoreDataLogs"디렉토리에있는 파일의 무리가 있습니다, 그러나 나는 간결 여기를 보이지 않았다).
이 문제는 내 파일 패키지 UTI를 잘못 작성하는 것과 관련이 있다고 생각할 수 있습니다. 다른 사용자가 iCloud와 함께 맞춤 파일 패키지를 성공적으로 사용 했습니까? 이거 버그 야?
여전히 UIManagedDocument 고통을 통해 고심하고 있습니다. 이것은 실제로 대답이 아니지만 "Documents"폴더 외부에 UIManagedDocuments를 저장하는 것이 좋습니다. 그렇지 않은 경우 사용자가 설정 -> iCloud -> 저장소 및 백업 -> 저장소 관리 ->으로 이동하면 DocumentMetadata.plist 항목이 표시됩니다. 내 문서를 Documents와 같은 수준의 별도 폴더에 넣습니다. 그런 다음 쿼리에 NSMetadataQueryUbiquitousDataScope를 사용해야합니다. 파일 확장자가 필요한지 또는이 경우 이해가되는지 확실하지 않습니다. –
Daniel