Still can't use ApplicationSupport

There are specific reasons to use SpecialFolder.ApplicationSupport on iOS (as on the Mac) but Xojo still throws an exception when trying to create a file or folder there. The documentation implies that it works when I’m pretty sure it’s never worked.

I know it’s been discussed before but for bugs like this, that have been reviewed and confirmed by staff and then sat unfixed for a long period of time, couldn’t we get a note added to the documentation? I just wasted half an hour on this, thinking it was something I was doing wrong.

feedback://showreport?report_id=37590

On MacOS its ApplicationData, which the documentation says resolves to Application Support

in new framework, SpecialFolder.ApplicationSupport resolves to …/Library/Application Support on MacOS, but …/Library/ApplicationSupport (note - no space) on iOS

http://developer.xojo.com/xojo-io-specialfolder$ApplicationSupport

Documentation about the iOS file system says this:
Put app-created support files in the Library/Application support/ directory. (note spaces)

https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html

Does this offer any clues?
Does it make sense to ‘roll your own’ path to this folder?

I’ve also encountered this “issue” and searched as much as I could on this forum and on Feedback (I found this case from 2015: feedback://showreport?report_id=37590 still being “Reviewed” and thought Xojo just had to fix that).

But, for no logical reason, I thought perhaps the folder would just not exist in the first place. And, right, this is the actual problem: iOS doesn’t create the ApplicationSupport folder (inside your app) automatically.

Just use something like this and you can use the ApplicationSupport folder:

[code]dim b As Xojo.IO.BinaryStream
dim f As Xojo.IO.FolderItem

try
f=SpecialFolder.ApplicationSupport
if f<>nil and not f.Exists then f.CreateAsFolder
if f<>nil then f=f.Child(“MyCompany”) //Not sure this one is needed, since the ApplicationSupport folder instance is already in the sandboxed app (thus only belonging to the app, perhaps being the reason why it’s not automatically created by the OS).
if f<>nil and not f.Exists then f.CreateAsFolder
if f<>nil then f=f.Child(“com.mycompany.myapp.prefs”)

b=Xojo.IO.BinaryStream.Create(f)
[/code]

Enjoy!