title: PhoneGap 1.1.0 and iOS 5.0 FileWriter does not respond
body: <p>I am using PhoneGap 1.1.0 and iOS 5.0, and have struggled on FileWriter problem.</p>
  
  <p>Here's the full example of <a href="http://docs.phonegap.com/en/1.1.0/phonegap_file_file.md.html#FileWriter" rel="nofollow">http://docs.phonegap.com/en/1.1.0/phonegap_file_file.md.html#FileWriter</a>
  does work fine.
  Creating a FileWriter from the onDeviceReady works.</p>
  
  <p>However, since what I want to do is to create a FileWriter depending on
  various filenames on demand, I did as follows:</p>
  
  <pre><code>(function ($){
  document.addEventListener("deviceready", function ()
  {
    var FSroot;
    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onInitFs, errorHandler);
  
    function onInitFs(fs)
    {
         FSroot = fs.root;
         //.......
    }
  
    //.......
  
    function writeFile(myText1)
     {
        var filename = "namedProgramatically";
  
        alert("CHECK1");
        FSroot.getFile(filename, {create: true}, gotFileEntry, fail);
  
        function gotFileEntry(fileEntry)
                           {
                              alert("CHECK2");
                              fileEntry.createWriter(gotFileWriter, fail);
                           }
  
        function gotFileWriter(writer)
                           {
                              writer.onwrite = function(evt)
                                                    {alert("WRITE Done!!");};
                              writer.write(myText1);
                           }
  
        function fail(error)
                           {
                                alert(error.code);
                           }
  
  
     }
     //...........
  
   }); //========================
  })(jQuery)
  </code></pre>
  
  <p>This code does not work.
  I see "CHECK1" alert, but not "CHECK2".
  I have no clue, what is wrong?
  Please give me some advice.
  Thank you.</p>
  
  <p>Ken</p>
  
  <p>(edit)
  The problem may be a JavaScript-JQuery scope issue although I'm not sure.
  I have re-developed a FileWrite unit test code on iOS5.0+ PhoneGap1.1.0 + JQuery1.7, and finally it works as I intended.
  Here is the full working code.(my Google Docs link)</p>
  
  <p><a href="https://docs.google.com/document/pub?id=1B58qVbIldDQ6s_WbPiCwB9MDnXxqlidUBbwQxNP2geg" rel="nofollow">https://docs.google.com/document/pub?id=1B58qVbIldDQ6s_WbPiCwB9MDnXxqlidUBbwQxNP2geg</a></p>