I'm trying to run my program as an sandboxed app. It's a Drag&Drop PDF Converter.
Everything works fine but creating & converting the file doesn't work well since i turned it into a sandboxed app.
What i tried to do with NSFileCoordinator is:
let temporaryPath = NSTemporaryDirectory()
var temporaryFile = temporaryPath + "temp.pdf"
var counter2 = 0;
while (fileM.fileExists(atPath: temporaryFile))
{
counter2 = counter2 + 1
temporaryFile = temporaryPath + "temp" + String(counter2) + ".pdf"
}
let defaults: UserDefaults = UserDefaults.standard
if (defaults.value(forKey:"countedSettings") != nil)
{
settings = defaults.integer(forKey: "countedSettings")
}
let settingsAsString = String(settings)
task.arguments = [url.path!, temporaryFile, settingsAsString]
task.launch()
let furl = NSURL.fileURL(withPath: temporaryFile)
let appURL = NSURL.fileURL(withPath: appendingString)
let fc = NSFileCoordinator()
fc.item(at: furl, willMoveTo: appURL as URL)
- Create a temporary file
- Read and copy/move the temporary file to the resource path
I know that i use NSFileCoordinator wrong, but i dont know where to start to fix this. Can someone help me with this problem?