Question

I have an application which I have written in MonoTouch. I dropped a file called ARCSDev into the applications folder and included it in the project, I then tried to read in the file using the following code:

private void generateChart (int chartNumber, string palette)
        {
            string path = Environment.GetFolderPath (Environment.SpecialFolder.Personal); 
            string filePath = Path.Combine(path, "ARCSDev");

            Loader loader = new Loader (filePath);

However my application can't seem to find the file, can anyone explain what I'm doing wrong?

Was it helpful?

Solution

From a quick look you're trying to load from the "Documents" directory (i.e. the one you have read-write access, could access via iTunes and get backed up), while your own file is inside the application directory (which is read-only).

What you want is (likely) NSBundle.MainBundle.BundlePath

This Xamarin's article covers this (and a lot more) about the iOS file system.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top