如何在选择并下载到设备之前,在iCloud中查找文档的大小,使用UIDocumentPickerViewController。我可以将文档下载到设备上,然后转换为NSData,我可以确定文件大小,但是我们能否避免下载文档本身并预先确定文件大小。我在uidocumentpickerviewcontroller中找不到任何方法或属性。
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url {
NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil];
NSError *error = nil;
[coordinator coordinateReadingItemAtURL:url options:0 error:&error byAccessor:^(NSURL *newURL) {
//assuming the file coordinator has downloaded the file here and provided the new url here
}
}
startAccessingSecurityScopedResource
开始访问安全范围资源后访问文件夹内容时,会抛出错误,表示所述文件夹不存在于该位置。 - Suran