title: Can't get Phonegaps FileWriter to work
body: <p>New to Phonegap and having a hard time understanding the <code>FileWriter</code> function. I am trying to get this example to work on iOS6 but I'm stuck with the <code>error</code> message</p>
  
  <pre><code>    &lt;script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" charset="utf-8"&gt;
  
          var fileWriter;
          function onNotesLoad() {
              window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFSComplete, fail);
          }
          function onFSComplete(fileSystem) {
              // Load the notes.txt file, create it if it doesn't exist
              fileSystem.root.getFile("notes.txt", {create: true}, onFileEntryComplete, fail);
          }
          function onFileEntryComplete(fileEntry) {
              // set up the fileWriter
              fileEntry.createWriter(onFileWriterComplete, fail);
          }
          function onFileWriterComplete(fileWriter) {
              // store the fileWriter in a
              // global variable so we have it
              // when the user presses save
              fileWriter = fileWriter;
          }
          function saveNotes() {
              // make sure the fileWriter is set
              if (fileWriter != null) {
                  // create an oncomplete write function
                  // that will redirect the user
                  fileWriter.onwrite = function(evt) {
                      alert("Saved successfully");
                      $.mobile.changePage("index.html");
                  };
                  var form = document.getElementsByTagName('form')[0].elements;
                  var notes = form.notes.value;
                  // save the notes
                  fileWriter.write(notes);
              } else {
                  alert("There was an error trying to save the file");
              }
              return false;
          }
          function fail(error) {
              alert(error.code);
          }
          &lt;/script&gt;
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;body&gt;
      &lt;div data-role="page" id="notes-page"&gt;
          &lt;div data-role="header" data-position="inline"&gt;
              &lt;a href="index.html" data-icon="delete"&gt;Cancel&lt;/a&gt;
              &lt;h1&gt;Your Thoughts?&lt;/h1&gt;
              &lt;a onClick="return saveNotes()" href="#"
                  data-icon="check" data-theme="b"&gt;Save&lt;/a&gt;
          &lt;/div&gt;
          &lt;form action="index.html" method="post"&gt;
              &lt;textarea name="notes" rows="30" cols="10"&gt;&lt;/textarea&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>