title: iPhone 4S - UnAuthorized Access Exception
body: <p>This is a question I am sure Xcode developers could also answer. I have a screenshot of my code below in Xamarin.</p>
  
  <p>Why am I getting an Unauthorized access exception? I should be able to write to the documents folder right?</p>
  
  <pre><code>var webClient = new WebClient();
          //var documentsFolder = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // iOS 7 and earlier
          var documentsFolder = NSBundle.MainBundle.BundlePath;
          var fileNameAndPath = Path.Combine (documentsFolder, "verses.xml");
  
  
          if(!File.Exists(documentsFolder)){
  
              Directory.CreateDirectory(documentsFolder);
  
              if(!File.Exists(fileNameAndPath)){
  
                  //File.SetAttributes(fileNameAndPath, FileAttributes.Normal);
                  File.Create(fileNameAndPath);
                  //Throws exception here.
  
              }
  
          }
  </code></pre>
  
  <p>And ERRORs:</p>
  
  <p>Access to the path "/var/mobile/Applications/1F95D694-BBA5-4FB3-AE6C-0C2CDD9DEDD8/comexample.app/verses.xml" is denied</p>
  
  <p>Access to the path '/private/var/mobile/Applications/1F95D694-BBA5-4FB3-AE6C-0C2CDD9DEDD8/Documents/verses.xml' is denied.</p>
  
  <p>I have tried both paths and I get access denied.</p>