[ 
https://issues.apache.org/jira/browse/CB-9936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16167945#comment-16167945
 ] 

Evan Wieland commented on CB-9936:
----------------------------------

I can confirm that this work-around does the trick.

> iOS File Transfer not receiving Progress Event
> ----------------------------------------------
>
>                 Key: CB-9936
>                 URL: https://issues.apache.org/jira/browse/CB-9936
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-file-transfer
>    Affects Versions: 1.4.0
>         Environment: iOS
>            Reporter: Tony Leung
>            Priority: Minor
>              Labels: cannot-reproduce, triaged
>         Attachments: screenshot.png
>
>
> In CDVFileTransfer.m, download() method between line 447 to 462
> {noformat}
>     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];}
>                    );
> {noformat}
> If I replaced it with the older version of the code, then it works.
> {noformat}
>     delegate.connection = [NSURLConnection connectionWithRequest:req 
> delegate:delegate];
>     if (activeTransfers == nil) {
>         activeTransfers = [[NSMutableDictionary alloc] init];
>     }
>     [activeTransfers setObject:delegate forKey:delegate.objectId];
> {noformat}
> In summary, if we don't use GCD to start the NSURLConnection, it works.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to