从iCloud Drive下载图片iOS目标C
我经历了很多链接,但没有为我工作。 我需要做的是获取所有iCloud Drive文件和下载图像。 我成功地使用下面的代码获取所有文件
- (void)presentDocumentPicker { NSArray *documentTypes = @[@"public.content", @"public.text", @"public.source-code ", @"public.image", @"public.audiovisual-content", @"com.adobe.pdf", @"com.apple.keynote.key", @"com.microsoft.word.doc", @"com.microsoft.excel.xls", @"com.microsoft.powerpoint.ppt"]; UIDocumentPickerViewController *documentPickerViewController = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:documentTypes inMode:UIDocumentPickerModeOpen]; documentPickerViewController.delegate = self; [self presentViewController:documentPickerViewController animated:YES completion:nil]; } #pragma mark - UIDocumentPickerDelegate - (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url { self.documentURL = url; QLPreviewController *previewController = [[QLPreviewController alloc] init]; previewController.delegate = self; previewController.dataSource = self; [self.navigationController pushViewController:previewController animated:YES]; }
现在我不知道如何进一步下载图像。
我能够使用这个下载图像
#pragma mark - UIDocumentPickerDelegate - (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url { self.documentURL = url; NSNumber *isDownloadedValue = NULL; BOOL success = [url getResourceValue:&isDownloadedValue forKey: NSURLUbiquitousItemIsDownloadingKey error:NULL]; if (success && ![isDownloadedValue boolValue]) { [[NSFileManager defaultManager]startDownloadingUbiquitousItemAtURL:url error:nil]; // load image from Ubiquity Documents directory NSData *imageData = [NSData dataWithContentsOfURL:url]; UIImage * image = [UIImage imageWithData:imageData]; } QLPreviewController *previewController = [[QLPreviewController alloc] init]; previewController.delegate = self; previewController.dataSource = self; [self.navigationController pushViewController:previewController animated:YES]; }
- NSUbiquityIdentityDidChangeNotification和SIGKILL
- 为什么连续多次调用NSMetadataQueryDidUpdateNotification?
- CloudKit – 如何共享多个logging并检索共享logging?
- 迁移持久性商店崩溃
- UIDocument loadFromContents失败,EXC_BAD_ACCESS
- CloudKit在不同的iCloud帐户之间共享数据,但不与所有人共享
- iCloud – 如何保存包含自定义对象数组的存档
- 在没有iCloud帐户的情况下使用CloudKit时,“无法发送有效签名”错误
- 即使在执行addSkipBackupAttributeToItemAtURL时,仍然可以备份到iCloud?