0

我正在尝试将拇指图像加载到CGPDFDocument. main我在 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
}

函数的实现thumbFileURL是:

- (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
}

但是当我运行它给我以下错误:

Undefined symbols for architecture i386:
"_CGImageSourceCreateWithURL", referenced from:
 -[ReaderThumbFetch main] in ReaderThumbFetch.o
4

1 回答 1

5

添加框架 ImageIOFramework。在 xcode 中,它是在项目设置选项卡中完成的:构建阶段->将二进制文件与库链接

于 2012-08-05T16:04:59.953 回答