Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- + (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
- - (void)downloadManager:(id)sender finishedDownload:(ANDownload *)download {
- if ( [[NSFileManager defaultManager] fileExistsAtPath:download.storeFile] ) {
- NSLog(@"Download exists");
- [self.labelStep setText:CustomLocalizedString(@"ZIP_DECOMPRESSING_MSG", nil)];
- [SSZipArchive unzipFileAtPath:download.storeFile toDestination:self.saveFolderPath progressHandler:^(NSString *entry, unz_file_info zipInfo, long entryNumber, long total) {
- //Your main thread code goes in here
- NSString * labelProgressText = [NSString stringWithFormat:@"%ld / %ld", entryNumber, total];
- self.labelProgress.text = labelProgressText;
- } completionHandler:^(NSString *path, BOOL succeeded, NSError *error) {
- NSLog(@"Succeeded %d in path: %@", succeeded, path);
- if(succeeded){
- .....
- dispatch_async(dispatch_get_main_queue(), ^{
- //Your main thread code goes in here
- yourLabel.text = @"new text";
- });
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- dispatch_async(dispatch_get_main_queue(), ^{
- //Your main thread code goes in here
- yourLabel.text = @"new text";
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement