代码:1000无法在我的应用程序中使用ionic-native/file创建文件ionic 2

问题描述:

我现在正在开发一个混合应用程序,用于处理本地化,其逻辑是用户将拥有3个选项选择语言,我在bluemix上有一个node.js服务器,它处理cloudant-nosql数据库以获取点我比较我的本地json文件“rev”值与服务器上的另一个如果他们不同,那么我必须覆盖用更新的一个本地文件,我有这样的结果,但我不能写数据到本地文件,我现在与科尔多瓦和离子2个工作,代码:1000无法在我的应用程序中使用ionic-native/file创建文件ionic 2

public GetRevFromNode(SelectedLanguage,JsonDataLocal) 
    { 
     JsonDataLocal.subscribe(val=>{ this.LocJson=val; }) 
     this.http.get('https://*********/retrev?ID=\"'+SelectedLanguage+"\"").subscribe(result=> 
     { 
      if(this.LocJson['_rev']==result.json().value) 
      { 
       console.log("The Local Json is Updated to the latest"); 
       return ; 
      } 
      { 
       console.log("Updating Json File for "+SelectedLanguage+".json ......."); 
       var ob=this.file.readAsText(this.file.applicationDirectory+'www/assets/i18n',"ar.json"); 
       ob.then(function(val){ 
        console.log("ar JSON = "+val); 
       }); 
       this.file.createFile('file:///android_asset/www',"ess.json",true).catch(val=>{ 
        console.log("Can't create because = "+JSON.stringify(val)); 
       }); 

    this.file.writeFile('file:///android_asset/www/',"index.html","\"value\":\"Please\"",{replace:true , append:false}).catch(val=>{ 
        console.log("Can't write because ="+JSON.stringify(val)); 
       console.log("Updating Done ...") 
      } 

     }); 


    } 

试图用this.file.appDirectory错误也试图让它隐含在这里,像这里 错误r是 未捕获的承诺[对象的对象] 通过使用字符串化{代码:1000}

,但我可以正常读取,并检查文件通常存在的问题是创建和写入

参见https://github.com/apache/cordova-plugin-file#android-file-system-layout

问题是我无法写入applicationDirectory路径,因为此路径为只读。