在iOS应用程序中打开iCloud驱动器
我想允许在我的应用程序中选择文档(pdf、doc、docx)。我想为此集成iCloud。我想做的就是从我的应用程序中打开iCloud驱动器,用户可以在那里选择文件并返回原始应用程序。类似whatsapp在iOS应用程序中对文档选择所做的操作在iOS应用程序中打开iCloud驱动器,ios,objective-c,iphone,icloud,icloud-drive,Ios,Objective C,Iphone,Icloud,Icloud Drive,我想允许在我的应用程序中选择文档(pdf、doc、docx)。我想为此集成iCloud。我想做的就是从我的应用程序中打开iCloud驱动器,用户可以在那里选择文件并返回原始应用程序。类似whatsapp在iOS应用程序中对文档选择所做的操作 对此有什么想法吗?阅读下面的链接,您将了解这个想法: 代码如下: -(IBAction)iCloudDriveFullFolder:(id)sender{ UIDocumentPickerViewController *documentPicker = [[
对此有什么想法吗?阅读下面的链接,您将了解这个想法: 代码如下:
-(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
}
}
老兄,非常感谢你这么做,我已经在这个问题上坚持了这么长时间,我克服了这个问题,一切都顺利!非常感谢。