In my script, I let the user select a file through the DocumentPicker, then I store that file path for later use in the form of a string. When trying to open that file later, I am getting an error from FileManager that the file doesn’t exist, but I am using the exact path that was returned to me by DocumentPicker.
Any insight here?
This is probably a restriction from iOS. I guess that you use
DocumentPicker.open, so iOS only allows to read the file if the picked file is outside the Scriptable folder. If you then try to write later, iOS doesn’t allow this. If you try to read it again, then it probably depends on the time between picking and reading the file. iOS probably only allows Scriptable to read the file in a short period of time.
A solution to just reading the file is to copy it to the Scriptable folder right after picking.