Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler
  2.  
  3. - (void)downloadManager:(id)sender finishedDownload:(ANDownload *)download {
  4. if ( [[NSFileManager defaultManager] fileExistsAtPath:download.storeFile] ) {
  5. NSLog(@"Download exists");
  6. [self.labelStep setText:CustomLocalizedString(@"ZIP_DECOMPRESSING_MSG", nil)];
  7.  
  8. [SSZipArchive unzipFileAtPath:download.storeFile toDestination:self.saveFolderPath progressHandler:^(NSString *entry, unz_file_info zipInfo, long entryNumber, long total) {
  9. //Your main thread code goes in here
  10. NSString * labelProgressText = [NSString stringWithFormat:@"%ld / %ld", entryNumber, total];
  11. self.labelProgress.text = labelProgressText;
  12. } completionHandler:^(NSString *path, BOOL succeeded, NSError *error) {
  13. NSLog(@"Succeeded %d in path: %@", succeeded, path);
  14. if(succeeded){
  15. .....
  16.  
  17. dispatch_async(dispatch_get_main_queue(), ^{
  18. //Your main thread code goes in here
  19. yourLabel.text = @"new text";
  20. });
  21.  
  22. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  23. dispatch_async(dispatch_get_main_queue(), ^{
  24. //Your main thread code goes in here
  25. yourLabel.text = @"new text";
  26. });
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement