Since two days I have this problem
I tried a lot,
https://stackoverflow.com/a/51764198/10392572
https://stackoverflow.com/a/46457518/10392572
https://stackoverflow.com/a/51218715/10392572
If I'm right, UIActivityViewController need an array of url(s) of the file(s) and documentInteractionController need an url and both ask user what he want do, but every time, if the user use "save to file" I have:
[default] [ERROR] Failed to determine whether URL /Users/lukashedinger/Library/Developer/CoreSimulator/Devices/45A185C5-6DEA-4A52-B415-939758FB7F7E/data/Containers/Data/Application/D4E32740-958D-43A6-BEC1-EECEB8CF732D/tmp/Vitalstoffwerte 22092018-22092018.pdf (n) is managed by a file provider
Anyone have idea if there is other way to ask user, where he want save a file or what I can do with my error?
Her is my code in short, perhaps something is wrong?
let dateiName = "Vitalstoffwerte " + heuteString
let path = "\(NSTemporaryDirectory())\(dateiName).pdf"
pdfData.write( toFile: path, atomically: true)
let fileUrl: URL = URL(fileURLWithPath: path)
let activityViewController = UIActivityViewController(activityItems: [fileUrl], applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view
self.present(activityViewController, animated: true, completion: nil)
------- UPDATE : Found a way for my problem, but not for file -----
I've given the pdfData direct to ViewController, haven't saved it to file.
UIActivityViewController(activityItems: [pdfData], applicationActivities: nil)
I'm not using a file and that is good enough for me
-- UPDATE --
My new idea is that first try to save the file and try it's URL, and if this fails, then use the pdfData directly, because in some simulator using URL gives no error and in other gives error.