Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28324

iOS: image from filereader function not being called

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 10.0.0, Release 9.3.3
    • Component/s: iOS
    • Labels:
    • Environment:

      MacOS Big Sur: 11.1 Beta 1
      Xcode: 12.23
      Java Version: 1.8.0_242
      Android NDK: 21.3.6528147
      Node.js: 12.18.1
      ""NPM":"5.0.0","CLI":"8.1.1""
      iPhone 8 14.2

    • Story Points:
      3
    • Sprint:
      2021 Sprint 6, 2021 Sprint 10

      Description

      On iOS the 2nd image which is being read in by filereader is not being loaded but on Android it works as expected.

      Test Case:

      var win = Ti.UI.createWindow({
      	backgroundColor:'white'
      });
       
       
      var earthFile,
        earthFileStream,
        earthBuffer;
       
      function fileReader(args) {
        if (args.bytesProcessed === -1) {
          Ti.API.error('Done');
          Ti.API.info(earthBuffer.toBlob().height + ' . ' + earthBuffer.toBlob().width + ' . ' + earthBuffer.toBlob().mimeType);
          earthImage.image = earthBuffer.toBlob();
          Ti.API.info(earthImage.image.height + ' . ' + earthImage.image.width + ' . ' + earthImage.image.mimeType);
          earthBuffer.release();
          earthImage.animate({
            opacity: 1,
            duration: 100
          });
        } else {
          Ti.API.error(args.bytesProcessed + ' of ' + args.totalBytesProcessed);
          if (earthBuffer === null) {
            earthBuffer = Ti.createBuffer();
          }
          earthBuffer.append(args.buffer);
        }
      }
       
      function loadEarth() {
        earthImage.image = null;
        earthImage.opacity = 0;
        earthFile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, '/Earth.jpg');
        earthFileStream = Ti.Filesystem.openStream(Ti.Filesystem.MODE_READ, earthFile.nativePath);
        earthBuffer = null;
        Ti.Stream.pump(earthFileStream, fileReader, 512, true);
      }
       
      var fishImage = Ti.UI.createImageView({
        left: '10dp',
        top: '10dp',
        right: '10dp',
        height: '200dp',
        image: '/ClownFish.jpg'
      });
      win.add(fishImage);
       
      var earthImage = Ti.UI.createImageView({
        left: '10dp',
        bottom: '10dp',
        right: '10dp',
        height: '200dp',
        opacity: 0
      });
      earthImage.addEventListener('singletap', loadEarth);
      win.add(earthImage);
       
      loadEarth();
      win.open();
      

      Test Steps:

      1. Create an application with the test case above
      2. Make sure app thinning is disabled in the tiapp.xml
      3. add the two images attached below into the resources folder
      4. Run application on iOS

      Actual result:
      2nd image does not load and nothing is logged in the console.

      Expected result:
      2nd image should load and log the following

      [ERROR]  Done
      [INFO]   1600 . 2560 . image/jpeg
      [INFO]   1600 . 2560 . image/jpeg
      

        Attachments

          Activity

            People

            • Assignee:
              vijaysingh Vijay Singh
              Reporter:
              smohammed Samir Mohammed
              Reviewer:
              Christopher Williams
              Tester:
              Satyam Sekhri
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration