I'm trying to use AVFoundation Framework to create a video thumbnail. I have correctly added and imported #import <AVFoundation/AVFoundation.
Here is the code for creating the thumbnail:
AVURLAsset *asset=[[AVURLAsset alloc] initWithURL:[NSURL URLWithString:moviePath] options:nil];
AVAssetImageGenerator *generator = [[AVAssetImageGenerator alloc] initWithAsset:asset];
generator.appliesPreferredTrackTransform=TRUE;
CMTime thumbTime = CMTimeMakeWithSeconds(0,30);
AVAssetImageGeneratorCompletionHandler handler = ^(CMTime requestedTime, CGImageRef im, CMTime actualTime, AVAssetImageGeneratorResult result, NSError *error){
if (result != AVAssetImageGeneratorSucceeded) {
NSLog(@"couldn't generate thumbnail, error:%@", error);
}
[imageButton setImage:[UIImage imageWithCGImage:im] forState:UIControlStateNormal];
//UIImage *thumbImg=[UIImage imageWithCGImage:im];
};
CGSize maxSize = CGSizeMake(320, 180);
generator.maximumSize = maxSize;
[generator generateCGImagesAsynchronouslyForTimes:[NSArray arrayWithObject:[NSValue valueWithCMTime:thumbTime]] completionHandler:handler];
When I build this, I get the following error:
Undefined symbols for architecture i386:_CMTimeMakeWithSeconds", referenced from:
-[photojournal generateImage] in photojournal.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've reviewed similar questions on Google and here on Stack Overflow, and the consensus seems to be to add missing files to compile sources. My question is - what are the missing files for AVFoundation? Shouldn't they all come when I import the Framework? Thanks.