PhoneGap 2.8.1 FileReader problem on Windows Phone 8

167 views
Skip to first unread message

amha...@gmail.com

unread,
Jun 22, 2013, 8:43:49 PM6/22/13
to phon...@googlegroups.com
I upgraded to PhoneGap 2.8.1 and my file reader code no longer works in Windows Phone 8.  If I revert to 2.7, it works.  If I run it on iOS 6.1, it works.  Have not tried Android yet (but will try that soon).

The log shows "Error in error callback: Filexxxx = TypeMismatchError"  Where Filexxx is the file id that is being read.  I can see and read the file on the device using WP Power Tools, it is a small json file.

Here is the code:

        dirEntry.getFile("config.json", { create: false, exclusive: false }, 
            function(fileEntry) {
                fileEntry.file( function(fileObj) {
                    var reader = new FileReader();
                    reader.onloadend = function(evt) {
                        console.log('reader.onloadend');
                        var config_file = evt.target.result;
                        // sometimes the result is already parsed
                        config = ((typeof config_file === 'object') ? config_file : jQuery.parseJSON(config_file));
                        console.log('parsed saved config for '+config.sitename+', '+config.device);
                    };
                    reader.readAsText(fileObj);
                },
                function(error) { console.log('Error reading config file '+error.code) });
            },
            function(error) { config.log('No config file to load'); });

No callbacks are ever triggered, I tried adding all of the callbacks just to see if anything fired.  Incidentally, I found that error string in cordova.js, and it prints the identical error exception message whether it came from the success callback or the error callback.  In my case it was actually trying to call the success callback (cordova.js for WinPhone8, line 277)  But I wasn's sure how to follow that code further.

Any help would be appreciated, thanks!

Anne Marie

Marc

unread,
Jul 22, 2013, 4:11:42 PM7/22/13
to phon...@googlegroups.com
I run into the same issue. Did you resolved the problem?

Marco Gaion

unread,
Aug 2, 2013, 8:29:30 AM8/2/13
to phon...@googlegroups.com
Same error for me with 2.9.0 . Someone solved it? Any workaround?

Fabian P

unread,
Aug 16, 2013, 11:27:52 AM8/16/13
to phon...@googlegroups.com
I'm having the same issue with 2.9. Any solutions?
Reply all
Reply to author
Forward
0 new messages