如何使用离子3将图像保存在IOS设备的图片库中?

时间:2019-06-04 06:40:43

标签: javascript ios swift ionic3 cordova-plugins

 let fileName = 'buildingAppImage' + Date.now() + '.jpeg';
        this.fileTransfer.download(img, (this.platform.is('android') ? this.file.externalRootDirectory + 'Download/': this.file.dataDirectory + 'Building-app-images/') + fileName).then((entry) => {
            console.log('download', entry.toURL());
            this.toast.createToast('Image downloaded successfully');
            this.dwnImg = entry.toURL();
            this.scale = temp;
            this.setZoom();
        }, err => {
            console.log(err);
            this.scale = temp;
            this.setZoom();
        })

我正在尝试将图像保存在ios设备的图库中。我尝试使用cordova文件传输,该文件传输适用于android,但不适用于ios。获得成功,但在使用iOS的情况下无法在文件或图库中看到图像。

2019-06-04 11:25:52.003362+0530 Building-app[315:11346] -[CDVFileTransferDelegate connection:didReceiveResponse:] [Line 771] Streaming to file /var/mobile/Containers/Data/Application/[app-uuid]/Library/NoCloud/Building-app-images/buildingAppImage1559627751907.jpeg
2019-06-04 11:25:52.010234+0530 Building-app[315:11346] File Transfer Finished with response code 200
2019-06-04 11:25:52.011050+0530 Building-app[315:11346] -[CDVFileTransferDelegate connectionDidFinishLoading:] [Line 637] File Transfer Download success
2019-06-04 11:25:52.018645+0530 Building-app[315:11256] download file:///var/mobile/Containers/Data/Application/[app-uuid]/Library/NoCloud/Building-app-images/buildingAppImage1559627751907.jpeg

我尝试了许多版本调整和不同的cordova插件(包括Cordova-photolibrary)。任何可行的解决方案都将得到高度应用。预先感谢。

 "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/android-permissions": "^4.20.0",
    "@ionic-native/camera": "^4.19.0",
    "@ionic-native/core": "~4.18.0",
    "@ionic-native/crop": "^4.18.0",
    "@ionic-native/device": "^4.20.0",
    "@ionic-native/diagnostic": "^4.20.0",
    "@ionic-native/file": "^4.20.0",
    "@ionic-native/file-transfer": "^4.20.0",
    "@ionic-native/network": "^4.20.0",
    "@ionic-native/photo-library": "^4.20.0",
    "@ionic-native/splash-screen": "~4.18.0",
    "@ionic-native/status-bar": "~4.18.0",
    "@ionic-native/toast": "^4.20.0",
    "@ionic/storage": "^2.2.0",
    "cordova": "^9.0.0",
    "cordova-ios": "~4.5.5",
    "cordova-plugin-add-swift-support": "^1.6.0",
    "cordova-plugin-android-permissions": "^1.0.0",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-crop": "^0.4.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^2.4.1",
    "cordova-plugin-network-information": "^2.0.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-toast": "^2.7.2",
    "cordova-sqlite-storage": "^2.6.0",
    "cordova.plugins.diagnostic": "^4.0.12",
    "fabric": "^2.4.6",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "ios-deploy": "^1.9.4",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  }

0 个答案:

没有答案