3

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?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jack Nutkins
  • 1,555
  • 5
  • 36
  • 71

1 Answers1

5

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.

poupou
  • 43,413
  • 6
  • 77
  • 174