0

Here is the problem: I open document with

func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL){}

save url like this: "/private/var/mobile/Containers/Data/Application/E8D502A1-7F9E-4E62-8DE3-7B66D711E35D/tmp/appName/15072021.ppdf»

and after some time i want to share this file with

UIDocumentInteractionController(url: url)

but

FileManager.default.fileExists(atPath: url.path)

returns false, so i cannot do that

can anybody help?

1 Answers1

0

When importing a document using Document Picker, a copy of selected document is saved in a temporary location. If you plan to use this document later on, you must move it to a proper space in your app sandbox. Here is what Apple documentation says:

The meaning of the provided URL varies depending on the document picker’s mode:

  • UIDocumentPickerModeImport

    The URL refers to a copy of the selected document. This document is a temporary file. It remains available only until your application terminates. To keep a permanent copy, you must move this file to a permanent location inside your sandbox.

Fahad Masood
  • 121
  • 7