Apache Cordova
  1. Apache Cordova
  2. CB-1219

iOS 6 - FileReader not triggering onloadend function

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.0, 2.0.0
    • Fix Version/s: Master
    • Component/s: iOS
    • Labels:

      Description

      On iOS 5.x the following code works as expected. Testing on iOS 6 beta 4 it appears that the callback is not called at all. This may also affect other callbacks in FileReader.

      var reader = new FileReader();
      reader.onloadend = function(evt)

      { console.log('This is never called'); }

      ;
      reader.readAsText(obj);

      Other research into this yields http://apache.markmail.org/thread/e4dhnq5qkn6ypprf which claims 5 of 95 tests in the File API fail on iOS 6 - though I have not verified this myself.

        Activity

        Hide
        Michal Mocny added a comment -

        CDVFile::readAsText and CDVFile::readAsDataURL are never invoked (which is why callback isn't firing), while other methods in CDVFile seem to work fine. Investigating why.

        Show
        Michal Mocny added a comment - CDVFile::readAsText and CDVFile::readAsDataURL are never invoked (which is why callback isn't firing), while other methods in CDVFile seem to work fine. Investigating why.
        Hide
        Michal Mocny added a comment -

        It seems that ios6 safari adds FileReader as a native api (http://caniuse.com/filereader). This is why the cordova functions are not firing..

        Perhaps the cordova api was meant as a stopgap until native implementations are added (we will still need to fix the current issues with usage), or perhaps the api needs renamed in order to not conflict?

        Show
        Michal Mocny added a comment - It seems that ios6 safari adds FileReader as a native api ( http://caniuse.com/filereader ). This is why the cordova functions are not firing.. Perhaps the cordova api was meant as a stopgap until native implementations are added (we will still need to fix the current issues with usage), or perhaps the api needs renamed in order to not conflict?
        Hide
        Michal Mocny added a comment -

        Clobbering the faulty native implementation fixes the tests: https://github.com/apache/incubator-cordova-js/pull/22

        Show
        Michal Mocny added a comment - Clobbering the faulty native implementation fixes the tests: https://github.com/apache/incubator-cordova-js/pull/22
        Hide
        Deepti added a comment -

        I am using Cordova 2.0 version.
        How is this issue fixed? in particular version?

        Deepti

        Show
        Deepti added a comment - I am using Cordova 2.0 version. How is this issue fixed? in particular version? Deepti
        Hide
        Michal Mocny added a comment -

        According to the metadata, it looks like this was fixed in 2.1. 2.0 is getting a bit old at this point, let me know how a more recent version works out for you. (Note that 3.0 was a more significant change, you may want to try 2.9 or earlier if you haven't been updating all this time).

        Show
        Michal Mocny added a comment - According to the metadata, it looks like this was fixed in 2.1. 2.0 is getting a bit old at this point, let me know how a more recent version works out for you. (Note that 3.0 was a more significant change, you may want to try 2.9 or earlier if you haven't been updating all this time).

          People

          • Assignee:
            Michal Mocny
            Reporter:
            Ben Longden
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development