I have written an app that creates a text file that is then used to populate a document. It all works fine on Android and Windows - the text file saves to an accessible location and can be attached to an e-mail.
On iOS the story is different. I seem to be able to save (I think) the file into the application storage directory, by using the following code.
file1 = File.applicationStorageDirectory.resolvePath("data.txt");
var stream1:FileStream = new FileStream();
stream1.open(file1, FileMode.WRITE);
stream1.writeUTFBytes(string1+"\r\n"+string2);
stream1.close();
I say I think it saves, as my popup appears to tell me that the file is saved, so it is at least working through the code. With other directory references the button does nothing.
But I cannot find any way to then navigate to that folder so that I can attach it to an e-mail. I have tried different email clients, different file managers but nothing seems to work. I thought about saving to the iCloud or google Drive, but there does not seem to be the facility to do that in iOS11.
I am sure I cannot be the only person trying to share an app generated text data file through iOS, but I cannot find any ways to do it.
Any help much appreciated.
Copyright Notice:Content Author:「adamski68」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/52043245/as3-save-file-in-accessible-location-on-ios