0

I am downloading hundreds of files with NSURLSessionConfiguration. I am updating a progress label for each downloaded file, from method

 -(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location. 

Suddenly it stopped updating progress label. I have tried performSelectorOnMainThread,dispatch_async(dispatch_get_main_queue() but to no avail.

What could be wrong? How can I update UI from didFinishDownloadingToURL method?

Any help would be appreciated. Thanks

Fahim
  • 3,466
  • 1
  • 12
  • 18
Devesh
  • 193
  • 1
  • 1
  • 8

1 Answers1

0

Does it run on main thread?

The most reliable solution for UIView is

[View performSelectorOnMainThread:@selector(Update:) withObject: ProgressObj waitUntilDone:FALSE];

It will guarantee that the UI update is being executed on correct thread. If you are using Core Graphics - keep Context pointer as your class variable. However, I prefer CALayer object for such kind manipulations

ETech
  • 1,613
  • 16
  • 17