0
こんにちはiPhoneの電話機の公式のローカルディレクトリをコピーできません。 この関数でエラーが発生しましたcopyFileToLocalDir
電話のギャラリーとカメラから画像を取得するたびに、私はいつもエラーが発生します。アンドロイド携帯電話の各写真の後に、各写真はローカルライン上にあります。どうすれば入手できますか? iOS携帯電話でシームレスに作業すると、なぜAndroid携帯電話で動作しますか?イオン2画像のローカルディレクトリコピーが機能しない
presentActionSheet(){
let actionSheet = this.actionSheetCtrl.create({
title : "Resim Kaynağını Seçiniz",
buttons : [{
text : "Galeriden Seç",
handler :()=>{
this.takePicture(this.camera.PictureSourceType.PHOTOLIBRARY);
}
},{
text : "Resim Çek",
handler :()=>{
this.takePicture(this.camera.PictureSourceType.CAMERA);
}
}]
});
actionSheet.present();
}
takePicture(SOURCETYPE){
var options = {
quality : 25,
sourceType : SOURCETYPE,
destinationType : this.camera.DestinationType.FILE_URI,
encodingType : this.camera.EncodingType.JPEG,
saveToPhotoAlbum : false,
correctOrientation : true
};
var yerelDizinAndroid;
var yerelDizinIOS;
this.camera.getPicture(options).then((imagePath)=>{
if(this.platform.is('android') && SOURCETYPE === this.camera.PictureSourceType.PHOTOLIBRARY){
this.filePath.resolveNativePath(imagePath).then(filePath =>{
let correctPath = filePath.substr(0, filePath.lastIndexOf('/') + 1);
let currentName = imagePath.substring(imagePath.lastIndexOf('/') + 1, imagePath.lastIndexOf('?'));
yerelDizinAndroid = currentName;
this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
});
}else {
var currentName = imagePath.substr(imagePath.lastIndexOf('/') + 1);
var correctPath = imagePath.substr(0, imagePath.lastIndexOf('/') + 1);
yerelDizinIOS = currentName;
this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
}
}, (err) => {
this.presentToast('Herhangi bir işlem yapılmadı.');
/* this.file.removeDir(cordova.file.dataDirectory, yerelDizinAndroid);
this.file.removeDir(cordova.file.dataDirectory, yerelDizinIOS); */
});
}
private createFileName() {
var newFileName = "S" + window.localStorage.getItem("auth_key") + ".jpg";
return newFileName;
}
private copyFileToLocalDir(namePath, currentName, newFileName) {
this.file.copyFile(namePath, currentName, cordova.file.dataDirectory, newFileName).then(success => {
this.lastImage = newFileName;
}, (error) => {
this.presentToast('Görsel yerel dizine taşınamadı..');
});
}
あなたが取得している特定のエラーとは何ですか?そして明らかにするために、Androidではうまく動作しますが、iOSでは正しく動作しませんか? – lintmouse
はい、iOS携帯電話でしか動作しません@lintmouse – Degisim
あるプラットフォームでは動作しますが、他のプラットフォームでは動作しない場合は、おそらく特定のプラットフォームの制限/アクセス権があります。正しいファイルパスを使用していることを確認してください。私はこれがイオン/フレームワークに関連しているとは思わない、もっとOS/Cordovaに関連している。 – DanteTheSmith