在iOS应用中打开iCloud Drive [英] Open iCloud Drive in iOS app
问题描述
我想在我的应用中允许选择文档(pdf,doc,docx)。我想为此整合iCloud。我想要做的就是从我的应用程序打开iCloud驱动器,用户可以选择该文件并返回原始应用程序。类似whatsapp的东西已经在iOS应用程序中进行了文档选择。
I want to allow document(pdf, doc, docx) selection in my app. And I want to integrate iCloud for this. All I want to do is to open the iCloud drive from my app and there user can select the file and returns back to the origin app. Something like whatsapp has done for document selection in iOS app.
有关于此的任何想法吗?
Any idea regarding this?
推荐答案
阅读下面的链接,你会得到的想法:的 https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentPickerProgrammingGuide/AccessingDocuments/AccessingDocuments.html
Read this below link you will get idea: https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentPickerProgrammingGuide/AccessingDocuments/AccessingDocuments.html
下面是代码:
-(IBAction)iCloudDriveFullFolder:(id)sender{
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.data"]
inMode:UIDocumentPickerModeImport];
documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:documentPicker animated:YES completion:nil];
}
#pragma mark - iCloud files
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url {
if (controller.documentPickerMode == UIDocumentPickerModeImport) {
// NSString *alertMessage = [NSString stringWithFormat:@"Successfully imported %@", [url lastPathComponent]];
//do stuff
}
}
这篇关于在iOS应用中打开iCloud Drive的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!