You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Vladimir Kotikov (JIRA)" <ji...@apache.org> on 2016/08/18 08:14:20 UTC
[jira] [Updated] (CB-9936) iOS File Transfer not receiving Progress
Event
[ https://issues.apache.org/jira/browse/CB-9936?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vladimir Kotikov updated CB-9936:
---------------------------------
Description:
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.
was:
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.
> 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: Plugin File Transfer
> Affects Versions: 1.3.0
> Environment: iOS
> Reporter: Tony Leung
> Priority: Minor
> Labels: connection, event, filetransfer, progress
>
> 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.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org