apache / cordova-plugin-file-transfer

Apache Cordova File Transfer Plugin
https://cordova.apache.org/
Apache License 2.0
598 stars 885 forks source link

onprogress does not work on iOS when uploading file. #234

Open cq0702 opened 5 years ago

cq0702 commented 5 years ago

Bug Report

Problem

onprogress does not work on iOS when uploading file.Android success.

What is expected to happen?

onprogress return data when uploading file.

What does actually happen?

onprogress does not work when uploading file.

Information

Command or Code

import { FileTransfer, FileUploadOptions, FileTransferObject } from '@ionic-native/file-transfer';

@Injectable() export class UploadService {

fileTransfer: FileTransferObject;

constructor( private transfer: FileTransfer, private config: Config, private user: User ) { this.fileTransfer = this.transfer.create(); }

// 执行文件上传 this.fileTransfer.upload(file.filePath, this.config.host + '/appProduct/document/upload' , options, false).then( result => { console.log('result'); } ).catch( error => { console.error(error); } );

this.fileTransfer.onProgress((progressEvent) => { console.log('----progressEvent----',progressEvent) });

}

Environment, Platform, Device

"cordova-plugin-file": "^4.3.3",
"cordova-plugin-file-transfer": "^1.6.3",
"ionic-angular": "^3.9.5",
"cordova-ios": "^4.4.0",

on iOS.

Version information

{ "name": "wzlApp", "author": "Ionic Framework", "homepage": "http://ionicframework.com/", "private": true, "scripts": { "clean": "ionic-app-scripts clean", "build": "ionic-app-scripts build", "ionic:build": "ionic-app-scripts build", "ionic:serve": "ionic-app-scripts serve" }, "dependencies": { "@angular/animations": "5.0.0", "@angular/common": "5.0.0", "@angular/compiler": "5.0.0", "@angular/compiler-cli": "5.0.0", "@angular/core": "5.0.0", "@angular/forms": "5.0.0", "@angular/http": "5.0.0", "@angular/platform-browser": "5.0.0", "@angular/platform-browser-dynamic": "5.0.0", "@angular/platform-server": "5.0.0", "@ionic-native/android-fingerprint-auth": "^4.20.0", "@ionic-native/app-version": "3.12.1", "@ionic-native/call-number": "3.12.1", "@ionic-native/camera": "^4.0.0", "@ionic-native/clipboard": "^4.3.2", "@ionic-native/core": "^4.3.1", "@ionic-native/device": "^4.20.0", "@ionic-native/file": "^3.12.1", "@ionic-native/file-transfer": "^4.20.0", "@ionic-native/geolocation": "^4.20.0", "@ionic-native/http": "^4.5.3", "@ionic-native/image-picker": "^4.0.0", "@ionic-native/in-app-browser": "^4.4.2", "@ionic-native/keyboard": "^3.14.0", "@ionic-native/media": "^4.20.0", "@ionic-native/network": "^4.20.0", "@ionic-native/photo-library": "^4.20.0", "@ionic-native/qqsdk": "^4.20.0", "@ionic-native/qr-scanner": "^4.20.0", "@ionic-native/splash-screen": "3.12.1", "@ionic-native/status-bar": "^4.5.3", "@ionic-native/touch-id": "^4.20.0", "@ionic-native/transfer": "^3.12.1", "@ionic-native/zbar": "^4.3.2", "@ionic/storage": "2.1.3", "angular-svg-round-progressbar": "^1.1.0", "call-number": "^1.0.1", "com.synconset.imagepicker": "https://github.com/Telerik-Verified-Plugins/ImagePicker.git", "cordova-android": "^6.2.3", "cordova-android-support-gradle-release": "^3.0.0", "cordova-browser": "^4.1.0", "cordova-hot-code-push-plugin": "^1.5.3", "cordova-ios": "^4.4.0", "cordova-plugin-camera": "^2.4.1", "cordova-plugin-compat": "^1.1.0", "cordova-plugin-console": "~1.0.5", "cordova-plugin-crosswalk-webview": "^2.3.0", "cordova-plugin-cszbar": "^1.3.4", "cordova-plugin-device": "~1.1.4", "cordova-plugin-file": "^4.3.3", "cordova-plugin-file-transfer": "^1.6.3", "cordova-plugin-http": "^1.2.0", "cordova-plugin-inappbrowser": "^1.7.2", "cordova-plugin-ionic-webview": "^1.1.16", "cordova-plugin-network-information": "^1.3.3", "cordova-plugin-splashscreen": "~4.0.1", "cordova-plugin-statusbar": "^2.4.1", "cordova-plugin-telerik-imagepicker": "git+https://github.com/Telerik-Verified-Plugins/ImagePicker.git", "cordova-plugin-whitelist": "~1.3.1", "cordova-sqlite-storage": "^2.0.4", "ionic-angular": "^3.9.5", "ionic-image-loader": "^3.2.1", "ionic-plugin-keyboard": "~2.2.1", "ionicons": "3.0.0", "mx.ferreyra.callnumber": "~0.0.2", "rxjs": "5.5.2", "sw-toolbox": "3.6.0", "zone.js": "0.8.18" }, "devDependencies": { "@ionic/app-scripts": "3.1.0", "cordova": "^6.5.0", "cordova-sqlite-storage-dependencies": "^1.0.3", "http-proxy-middleware": "^0.17.3", "typescript": "2.4.2" }, "cordovaPlugins": [ "cordova-plugin-whitelist", "cordova-plugin-console", "cordova-plugin-device", "cordova-plugin-splashscreen", "ionic-plugin-keyboard" ], "cordovaPlatforms": [], "description": "myApp: An Ionic project", "cordova": { "plugins": { "cordova-plugin-console": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-whitelist": {}, "ionic-plugin-keyboard": {}, "cordova-plugin-crosswalk-webview": { "XWALK_VERSION": "23+", "XWALK_LITEVERSION": "xwalk_core_library_canary:17+", "XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect", "XWALK_MODE": "embedded", "XWALK_MULTIPLEAPK": "true" }, "phonegap-plugin-push": {}, "mx.ferreyra.callnumber": {}, "cordova-plugin-file": {}, "cordova-plugin-file-transfer": {}, "cordova-plugin-camera": { "CAMERA_USAGE_DESCRIPTION": " ", "PHOTOLIBRARY_USAGE_DESCRIPTION": " " }, "com.synconset.imagepicker": { "PHOTO_LIBRARY_USAGE_DESCRIPTION": "为了能够使您正常上传文件" }, "cordova-sqlite-storage": {}, "cordova-clipboard": {}, "cordova-plugin-network-information": {}, "cordova-plugin-cszbar": {}, "cordova-plugin-inappbrowser": {}, "cordova-plugin-http": {}, "cordova-hot-code-push-plugin": {}, "PALink": {}, "cordova-plugin-statusbar": {}, "cordova-plugin-ionic-webview": {}, "cordova-android-support-gradle-release": { "ANDROID_SUPPORT_VERSION": "27.0.0" } }, "platforms": [ "android", "browser", "ios" ] } }

HectorGlez4 commented 5 years ago

@cq0702 i think im having the same problem.

"dependencies": { "cordova-android": "6.2.3", "cordova-ios": "4.4.0", "cordova-plugin-camera": "2.4.1", "cordova-plugin-compat": "1.2.0", "cordova-plugin-console": "1.1.0", "cordova-plugin-device": "1.1.7", "cordova-plugin-file": "4.3.3", "cordova-plugin-splashscreen": "4.1.0", "cordova-plugin-statusbar": "2.4.1", "cordova-plugin-whitelist": "1.3.3", "ionic-plugin-keyboard": "2.2.1", "onesignal-cordova-plugin": "2.2.5", "cordova-plugin-calendar": "^4.6.0" }, "cordova": {

i got this configuration and my application worked fine in ios 12.x and the upload of images stop working in 13.x

did you solved this problem?

janpio commented 5 years ago

Is this reproducible in a new, plain Cordova app? A minimal reproduction repository would really help to debug and later fix this issue. More information on how to create one: https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md