我正在使用Ionic 4,并且我已经安装了插件(添加--save插件),但是仍然遇到相同的错误,我该怎么做才能解决该问题?非常感谢。
致谢
我的代码是:
constructor(private imagePicker: ImagePicker,
private afs: AngularFirestore,
private route: ActivatedRoute,
private nav: NavController,
private alertController: AlertController) {}
goPhotoGallery() {
//console.log("My storageRef: " + this.storageRef)
this.options = {
maximumImagesCount: 3,
// max width and height to allow the images to be. Will keep aspect
// ratio no matter what. So if both are 800, the returned image
// will be at most 800 pixels wide and 800 pixels tall. If the width is
// 800 and height 0 the image will be 800 pixels wide if the source
// is at least that wide.
width: 400,
//height: 200,
// quality of resized image, defaults to 100
quality: 50,
// output type, defaults to FILE_URIs.
// available options are
// window.imagePicker.OutputType.FILE_URI (0) or
// window.imagePicker.OutputType.BASE64_STRING (1)
outputType: 1
};
this.imageResponse = [];
this.imagePicker.getPictures(this.options).then(results => {
for (var i = 0; i < results.length; i++) {
//this.imageResponse.push('data:image/jpeg;base64,' + results[i]);
this.storageRef.put('data:image/jpeg;base64,' + results[i]) // I'm trying to upload the files to Firestore but when i'm doing click on the icon to active this method it shows me an alert with plugin not installed and on my phone neither... I'm using Ionic Devapp to reproduce it, didn't try to make a sign and test it using the APK
.then(function (snapshot) {
console.log('Uploaded a blob or file!');
});
}
}, (err) => {
alert(err);
});
}