2012-06-09 2 views
0

Я пытаюсь написать файл в android с помощью phonegap cordova 1.5.0. Ниже приведен фрагмент кода. Этот фрагмент кода работает хорошо в тренажере, но когда я запускаю это на моем андроид мобильном он идет до gotFs(), а затем «глючить код ошибки» предупреждение о сбое() всплывает с сообщениемОшибка написания файла телефонной книги 1

«глючить код ошибки 1»

, что означает, что он терпит неудачу на линии

fileSystem.root.getFile("projectFileName", {create: create: true, exclusive: false}, gotFileEntry, fail);

.

фрагмент кода

  function onDeviceReady() { 
       window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail); 
      } 

       function gotFS(fS) { 
      fileSystem = fS; 
      fileSystem.root.getFile("projectFileName", {create: create: true, exclusive: false}, gotFileEntry, fail); 
      } 

      function gotFileEntry(fE) { 
      fileEntry = fE; 
      fileEntry.createWriter(gotFileWriter, fail); 
      } 


      function gotFileWriter(writer) { 
      .......... file writing code. 
      } 

     function fail(error) { 
      alert('fail error code = '+error.code); 
      alert('error '+error); 
      console.log(error.code); 
     } 

Тренажер АВД 2.3.3 и мое устройство андроид 2.3.6.

ответ

2
fileSystem.root.getFile("projectFileName", {create: create: true, exclusive: false}, gotFileEntry, fail); 

в

fileSystem.root.getFile("projectFileName", {create: true, exclusive: false}, gotFileEntry, fail); 
Смежные вопросы