Air iOS Flash, what is the included folder path? - ios

This is kinda silly but I can't seem to find the directory path for the included folder.
In Flash Cs6 publish setting, I included a folder which is located at c:\abc\def\ghi/xxx.
In this case, the path in iOS will be app://xxx?
To access a flle in the folder, what string do I exactly need to pass to the URLRequest?

I think you are trying to access applicationDirectory. In iOS standard directories native path like
app:/ means applicationDirectory
applicationDirectory - /var/mobile/Applications/uid/filename.app
applicationStorageDirectory - /var/mobile/Applications/uid/Library/Application Support/applicationID/Local Store
However you can access application directory file like
var applicationXMLFile:File = File.applicationDirectory.resolvePath("application_data.xml");
var applicationXMLUpdateFile:File = new File(applicationXMLFile.nativePath);
if we are trying access directly like
var applicationXMLFile:File = File.applicationDirectory.resolvePath("application_data.xml");
Sometimes it throws SecurityError/IOError.
http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7fe4.html#WS5b3ccc516d4fbf351e63e3d118666ade46-7d9e

Using a File.
If you want pass to URLRequest iOS Documents folder path.
try this:
var urlRequest:URLRequest = new URLRequest(File.documentsDirectory.resolvePath("myFile.txt").nativePath);

Related

Absolute path for the internal storage on iOS device

I am using PCLStorage to interact with local files on both Android and iOS platforms.
I am using the following code snippet.
IFolder rootFolder = await FileSystem.Current.GetFolderFromPathAsync(path);
IFolder folder = await rootFolder.CreateFolderAsync("HandSAppPdf", CreationCollisionOption.OpenIfExists);
IFile file = await folder.CreateFileAsync("Hello.pdf", CreationCollisionOption.GenerateUniqueName);
in the case of Android, I have the
path ="/storage/emulated/0/"
But I am not sure what would be the path in the case of iOS. if anyone can help me out, I would much appreciate that.
Your application’s access to the file system (and other resources such as the network and hardware features) is limited for security reasons. This restriction is known as the Application Sandbox.
Since iOS11, Files App in your phone has been used for users to access the document which an iOS application created. I recommend you to follow this File system access in Xamarin.iOS and its demo. You could generate a new text file in your Application's Documents Folder like this:
public static string WriteFile()
{
var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var filename = Path.Combine(documents, "Write.txt");
File.WriteAllText(filename, "Write this text into a file!");
return "Text was written to a file." + Environment.NewLine
+ "-----------------" + Environment.NewLine
+ File.ReadAllText(filename);
}
And this file could be accessed through Files App.
Also to allow the user to directly access files in your app, remember to create a new boolean key in the Info.plist file LSSupportsOpeningDocumentsInPlace and set it to true.

Get Resources\Raw Path in .NET Maui

I have an application which uses a SQLite database to store data locally. I get the path to and open the database using:
string dbPath = System.IO.Path.Combine(FileSystem.AppDataDirectory, "mydatabase")
db = new SQLiteConnection(dbPath);
I have created an example database (example.db3) and copied this to the Resources\Raw folder with the Build Action MauiAsset.
My question is how do I get the path to this database file so I can use
string dbPath = System.IO.Path.Combine("*path to Resources\Raw foldder*", "example.db3");
to get the full path to open the example database.
I have tried searching but the best I can get is using FileSystem.Current.OpenAppPackageFileAsync but this opens the file for stream reading whereas I need to get the path.
Ideally the method would work on all platforms.
It is a known issue about this problem.
You can follow it up here: https://github.com/dotnet/maui/issues/3270.
Thanks for your feedback and support.

Application private directory on iOS with access to creation of files from Qt APIs

I am using Qt app on iOS & want to save files into Application's private directory so that other apps cannot access my files. Reading through the documentation here, /Documents directory under data container looks to be the path to save my files which are private to app.
Firstly I chose to use QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) which returned
/var/mobile/Containers/Data/Application/123XX-XXXX-XXXX-XXXX/Library/Application Support/MyApp. But then I found that I could not create any files in there. Tried /Documents inside the App folder as well. But in vain.
Secondly I tried QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) which returned /var/mobile/Containers/Data/Application/123XX-XXXX-XXXX-XXXX/Documents. I am able to create & save my files here.
On iOS, which is the correct path to create files which are meant to be private to the application ?
How can I get the path using Qt?
The directory named with some ID as 123XX-XXXX-XXXX-XXXX, Is this the application directory or is it Library/Application Support/MyApp inside the same directory ?
I had same problem, for example I created a sqlite file. But the file that you will create can be every file you wants. In my example I need to create a sqlite file.
I solved like this:
QString dbName = "mydb.sql";
QString dbLocation;
#ifdef Q_OS_ANDROID
dbLocation = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
#endif
#ifdef Q_OS_IOS
dbLocation = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
#endif
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(dbLocation + "/" + dbName);
qDebug() << db.database(dbLocation + "/" + dbName);
qDebug() << db.databaseName();
Now you can save the file, I used DocumentsLocation to get a path, always works on iOS, but not work on Android, to be ready to Android you use another path: AppDataLocation.
In the documents location you can write/read/put and create files on iOS.
In the AppDataLocation location you can write/read/put and create files on Android.
Permission not denied in DocumentsLocation.

FTPHelper library not working iOS

Hello I have this code and don't download anything...
FTPHelper *ftp;
ftp.urlString = #"ftp.marignal.com";
ftp.uname = #"whttpapp.marignal.com";
ftp.pword = #"hidden";
ftp.filePath = #"Barcos/Imagenes";
[ftp download:#"catlanza.bmp"];
I'm using this lib: https://github.com/erica/iphone-3.0-cookbook-/tree/master/C13-Networking/15-FTP%20Helper
That method download, It suppose to install the selected file in Documents directory...
Look in the simulator for the path it copied to.
Likely you need to tack on Documents:
ftp.filePath = #"Documents/Barcos/Imagenes";
Or get the path programmatically:
What is the documents directory (NSDocumentDirectory)?

Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed

I have a .swf file which throws this error when I attempt to load it in a browser. Similar to other posts here this is the code:
var mySpite:Sprite = new Sprite();
var button:Loader = new Loader();
var url:String = "images/btnImage.png";
var urlReq:URLRequest = new URLRequest(url);
button.load(urlReq);
....
When I run the actionscript in Flex Build it works fine. Also when I double click the .swf file in the folder where it is stored, it works fine. I don't know why it only doesn't work and throws this error when I load it in a .jsp page.
It's most likely an issue with your path. Remember that the path to the image will be relative to the page which embeds the SWF.
In answer to your comment about having to change the paths when deploying, depending on how you're building and debugging your SWF, it might be possible to use Capabilities.playerType (see docs) to choose the correct path for the current environment. Another alternative might be to put all your image references in a couple of XML files (one local and one remote). As long as the path to the XML file is consistent between local and remote environments, you can update the SWF without worrying about the image paths.

Resources