I am creating queue where at first I compress images in background and add it to dictionary in main queue. The next then all images comprised and added I print message. I do not archive it with my code. Why?
dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSMutableArray *images = [_adv[@"images"] mutableCopy];
for (NSMutableDictionary *i in images)
{
UIImage *large = [UIImage compressImage:i[@"original"]];
dispatch_async(dispatch_get_main_queue(), ^{
i[@"large"] = large;
[i removeObjectForKey:@"original"];
});
}
dispatch_sync(dispatch_get_main_queue(), ^{
NSLog(@"%@", _adv);
NSLog(@"\n ГОТОВО");
});
});