SpecialFolder.Temporary on iOS

Hi,

I created a new iOS app and after finishing my tests in the Simulator I started On-Device testing now. I found a different behavior when trying to download a file to SpecialFolder.Temporary.

Trying this on device I get an error that I have no privileges to access the folder.
“Du hast nicht die Zugriffsrechte, um die Datei „5177E8AB-C30F-4753-A644-16816CDDB98C“ im Ordner „Application“ zu sichern.”

Am I doing something wrong?

Thanks alot.

best regards

Fabian

Did you try creating the folder first if it doesn’t exist?

Yes. But it already crashes as soon as define a variable. Even before I access it.

Var TempFolder as FolderItem = SpecialFolder.Temporary

I don’t know why but I use the following code in my apps to access the TemporaryFolder:

Dim TempFolder As FolderItem
//Bypassing SpecialFolder.Temporary because of strange results
Dim fTemp As xojo.io.FolderItem = xojo.IO.SpecialFolder.Temporary

if fTemp.Exists = False then
  fTemp.CreateAsFolder
End If

TempFolder = new FolderItem(fTemp.Path)
//Now TempFolder can be used 

Another workaround is to use SpecialFolder.Caches

Var folder As FolderItem
try
  folder = SpecialFolder.Caches
  if not folder.Exists then folder.CreateFolder
  
  folder = folder.Child("temp")
  if not folder.Exists then folder.CreateFolder

//Do something in the folder
  
Catch err as IOException
  //Disk is certainly full

end try
1 Like

That helps. Thank you very much.
So I assume there is a bug in SpecialFolder.Temporary