Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-9936

iOS File Transfer not receiving Progress Event

    XMLWordPrintableJSON

    Details

      Description

      In CDVFileTransfer.m, download() method between line 447 to 462

          delegate.connection = [[NSURLConnection alloc] initWithRequest:req delegate:delegate startImmediately:NO];
      
          if (self.queue == nil) {
              self.queue = [[NSOperationQueue alloc] init];
          }
          [delegate.connection setDelegateQueue:self.queue];
      
          @synchronized (activeTransfers) {
              activeTransfers[delegate.objectId] = delegate;
          }
          // Downloads can take time
          // sending this to a new thread calling the download_async method
          dispatch_async(
                         dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL),
                         ^(void) { [delegate.connection start];}
                         );
      

      If I replaced it with the older version of the code, then it works.

          delegate.connection = [NSURLConnection connectionWithRequest:req delegate:delegate];
          if (activeTransfers == nil) {
              activeTransfers = [[NSMutableDictionary alloc] init];
          }
          [activeTransfers setObject:delegate forKey:delegate.objectId];
      

      In summary, if we don't use GCD to start the NSURLConnection, it works.

        Attachments

        1. screenshot.png
          334 kB
          Vladimir Kotikov

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tl274n Tony Leung
            • Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: