I use AVAssetImageGenerator to get images from a movie clip without playing it before. Now I have a question, how to set up variables in a handler loop? Is it possible? I get an error message and have no idea what that means. (google> no results).
"Variable not assigned (missing __block type specifier)"
So, I have to ask the professionals here. Here is the code. I want to save or return my generated images, so I can delete the message "setImage" inside this handler.
UIImage* thumbImg = [[UIImage alloc] init]; AVAssetImageGeneratorCompletionHandler handler = ^(CMTime requestedTime, CGImageRef im, CMTime actualTime, AVAssetImageGeneratorResult result, NSError *error) { if (result != AVAssetImageGeneratorSucceeded) { NSLog(@"couldn't generate thumbnail, error:%@", error); } [button setImage:[UIImage imageWithCGImage:im] forState:UIControlStateNormal]; thumbImg = [[UIImage imageWithCGImage:im] retain]; [generator release]; };
It would be great to know about this. Thank you for your time.
source share