swifter icon indicating copy to clipboard operation
swifter copied to clipboard

How to share files from URL path (local app storage)

Open JunaidUmar opened this issue 5 years ago • 0 comments

I am trying to share file from URL path. App select images from photos convert them to pdf file, then store them on URL path with method: try? pdfDocument.write(to: self.pdfFilePath!) Now I want to share this file but function

if let file = try? filePath.openForReading()
{ }
else .notFound

always fails to open the file. If I place file in my directory and fetch the file using Bundle.main.resourcePath it successfully fetch it and show it, but when try to read file from app local storage then it fails.

How can I read file from iPhone app storage and share it ?

The path when I try to pick file from Bundle.main.resourcePath is /private/var/containers/Bundle/Application/BQ53FZZA-4871-1973-SS72-8CCAB2A9F9C5/ScanMagic.app/men.jpg

and when I try to get file from myURLpath.absoluteString var/mobile/Containers/Data/Application/25J94B88-86S2-953A-B47C-QC88B64POOR4/Documents/Scanner/file1.pdf

JunaidUmar avatar Jul 13 '20 13:07 JunaidUmar