gpt4 book ai didi

ios - 在 iOS 应用中打开 iCloud Drive

转载 作者:技术小花猫 更新时间:2023-10-29 11:14:55 25 4
gpt4 key购买 nike

我想允许在我的应用程序中选择文档(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

}
}

关于ios - 在 iOS 应用中打开 iCloud Drive,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37541347/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com