I'm trying to load thumb images in CGPDFDocument
.
I wrote the following code in a function called main
in class ReaderThumbFetch
.
NSURL *thumbURL = [self thumbFileURL];
CGImageRef imageRef = NULL;
CGImageSourceRef loadRef = CGImageSourceCreateWithURL((CFURLRef)thumbURL, NULL);
if (loadRef != NULL) // Load the existing thumb image
{
imageRef = CGImageSourceCreateImageAtIndex(loadRef, 0, NULL); // Load it
CFRelease(loadRef); // Release CGImageSource reference
}
The implementation of thumbFileURL
function is:
- (NSURL *)thumbFileURL
{
#ifdef DEBUGX
NSLog(@"%s", __FUNCTION__);
#endif
NSString *cachePath = [ReaderThumbCache thumbCachePathForGUID:request.guid]; // Thumb cache path
NSString *fileName = [NSString stringWithFormat:@"%@.png", request.thumbName]; // Thumb file name
return [NSURL fileURLWithPath:[cachePath stringByAppendingPathComponent:fileName]]; // File URL
}
But when I run it gives me the following error:
Undefined symbols for architecture i386:
"_CGImageSourceCreateWithURL", referenced from:
-[ReaderThumbFetch main] in ReaderThumbFetch.o
add the framework ImageIOFramework. In xcode it is done in the project setting tab: build phases->link binary with libs