Hey,
I updated recently to Cordova 7.0.0, cordova-plugin-file 4.3.3 and today ionic-native 3.6.1 and ionic-angular 3.2.0.
After all these update, File.readAsArrayBuffer promise is never resolved.
I tried without luck solution described in https://github.com/driftyco/ionic-native/issues/978 and https://github.com/driftyco/ionic-native/issues/505 (polyfill.js before cordova.js in index.html ... didn't worked).
Best regards
P.S.: For the record, same behavior tested on iPhone (6) and Android (Samsung Edge)
My info:
global packages:
@ionic/cli-utils : 1.0.0
Cordova CLI : 7.0.0
Ionic CLI : 3.0.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.0.0
@ionic/cli-plugin-ionic-angular : 1.0.0
Ionic Framework : ionic-angular 3.2.0
System:
Node : v7.2.1
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002
ios-deploy : 1.9.0
ios-sim : 5.0.13
I updated to these versions today coming from ionic 2 (except I updated ionic-native to 3.7) and ran into the same issue.
After playing around a bit with different versions of cordova, zone.js, rxjs, sw-toolbox, ionic-native I found a working one:
ionic-native/*@3.4.4
changing any other library did not seem to have any effect on this bug. After finding the correct ionic-native version I upgraded the other libraries again and it keeps working.
I would very much appreciate a fix for 3.7 - I would like to try out the new document-viewer plugin.
P.S.: All my testing was done with the workaround as described in #505 (polyfill.js before cordova.js in index.html) in place
@peterpeterparker @SirTori same issue here. Tested with readAsText. Drives me nuts!
@SirTori YOU ARE MY HERO!
Same problem.
Both happened in [ ionic 3.0.0, cordova 7.0.0, android 7.0 ] and [ ionic 2.2.3, cordova 6.5.0, android 4.4 ].
If the file to be read does not exist, catch can get FILE NOT EXIST. If file does exist, read callback just does not happen.
@zjw1918 @SirTori temporary solutions works perfectly!
@herrjemand Yes, thanks. Just need to change "ionic-native/file" version to 3.4.4.
Glad this helps some people.
It seems many are eager to update to the newest versions these days, a shame it (re)introduces this bug.
Since no errors are thrown its hard to debug and if you don't use the right keywords to find these issues here many hours can get lost to this.
This is a pretty old issue (#505) that was closed without a resolution but just a workaround (which wasn't even added to the examples and templates - so everyone using these plugins is bound to run into this). I hope now that the workaround doesn't work anymore since 3.6.1 (don't know about 3.5) and the issue is brought up again, a real solution will be seeked.
@SirTori I don't think this bug was reintroduced. I use ionic-native for File.readAsArrayBuffer since version alpha and I never had to use the workaround described in the issues I linked above.
I have same issue with file.readAsText, which is never resolved.
I think the issue is related to simplify commit, which suppose to have common code for readAsArrayBuffer, readAsText...
I will try to dig on it.
So... I've fixed the issue.
It works for me.
PR created.
@ihadeed is this fixed? I am having the same problem of this function not resolving.
my native-version:
npm list | grep native
├── @ionic-native/[email protected]
├── @ionic-native/[email protected]
├── @ionic-native/[email protected]
├── @ionic-native/[email protected]
├── @ionic-native/[email protected]
├── @ionic-native/[email protected]
├── @ionic-native/[email protected]
├── @ionic-native/[email protected]
├── @ionic-native/[email protected]
├── @ionic-native/[email protected]
I've modified index.html script order as such:
<!-- The polyfills js is generated during the build process -->
<script src="build/polyfills.js"></script>
<!-- cordova.js required for cordova apps. AFTER POLYFILL -->
<script src="cordova.js"></script>
<!-- The vendor js is generated during the build process
It contains all of the dependencies in node_modules -->
<script src="build/vendor.js"></script>
<!-- The main bundle js is generated during the build process -->
<script src="build/main.js"></script>
ionic info
ionic info
global packages:
@ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0
local packages:
@ionic/app-scripts : 2.0.2
@ionic/cli-plugin-cordova : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.5.3
System:
Node : v8.1.4
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.0
ios-sim : 5.0.2
npm : 5.0.3
thanks
@pliablepixels what platform?
@ihadeed I was about to delete my question but you responded - thankyou :-) running in iOS (host is OS X). I resolved the issue by removing and adding iOS platform
I still have that issue on iOS simulator 10.2, MacOS El-Captain

But the problem seems to be more related to the fact that UInt8Array is undefined for some reason and it just throws within the actual onReadSuccessCallback and the onerror is never called fromt there for X reason
Most helpful comment
So... I've fixed the issue.
It works for me.
PR created.