ios 如何在导出时从UIDocumentPickerViewController获取保存的文件名

0dxa2lsx  于 2023-06-25  发布在  iOS
关注(0)|答案(1)|浏览(139)

我使用UIDocumentPickerViewController保存一个文件,让它从一个临时位置移动和重命名一个文件:

UIDocumentPickerViewController* documentPicker = [[UIDocumentPickerViewController alloc] initForExportingURLs:@[theTempFileURL]  asCopy:YES];
[self presentViewController:documentPicker animated:true completion:nil];

作为此过程的一部分,用户可以为文件选择新名称。如何获取用户为保存选择的文件名?

l2osamch

l2osamch1#

想明白了我忘了为UIDocumentPickerViewController设置委托。在didPickDocumentsAtURL委托中,我可以检查控制器的模式。如果我处于UIDocumentPickerModeExportToService模式,那么传递给委托方法的URL列表就是文件保存位置的列表。

相关问题