在iOS应用中打开iCloud Drive

前端之家收集整理的这篇文章主要介绍了在iOS应用中打开iCloud Drive前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在我的应用程序中允许文档(pdf,doc,docx)选择.我想为此整合iCloud.我想要做的就是从我的应用程序打开iCloud驱动器,用户可以选择该文件并返回原始应用程序.类似whatsapp的东西已经在iOS应用程序中进行了文档选择.

对此有何看法?

解决方法

阅读以下链接,您将获得想法: 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

    }
}
原文链接:https://www.f2er.com/iOS/333011.html

猜你在找的iOS相关文章