IONIC [native-file,image-picker]在iOS上无法运行writeFile

时间:2018-01-06 05:22:46

标签: ionic-framework ionic2 ionic3

有这样一种方法:

 public loadGallery():void{
    let options ={
      maximumImagesCount: 20,
      width: 500,
      height: 500,
      quality: 75
    };
    this.imagePicker.getPictures(options).then((result) => {
      for (let i = 0; i < result.length; i++) {
        this.imgList.push({'win':{id: result[i], title: result[i]}});
      }
      let builder = new xml2js.Builder();
      let xml = builder.buildObject(this.imgList);
      this.file.writeFile(this.file.dataDirectory,'mywins.xml', xml, {replace: true});
    },
    function(errmsg){
      console.log('---->'+ errmsg)
    });
  }

在Android上它可以工作,在iOS上它只在第一次启动时保存,下面只在你拍摄照片时添加到阵列,但文件不会覆盖。

0 个答案:

没有答案