cgimagesourcecreatewithurl pdf

use*_*381 0 iphone cgpdfdocument ipad ios5

我正在尝试在CGPDFDocument中加载拇指图像我在类"ReaderThumbFetch"中的一个名为"main"的函数中编写了以下代码

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
}
Run Code Online (Sandbox Code Playgroud)

并且"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
}
Run Code Online (Sandbox Code Playgroud)

但是当我跑它时,它给了我:

Undefined symbols for architecture i386:
"_CGImageSourceCreateWithURL", referenced from:
 -[ReaderThumbFetch main] in ReaderThumbFetch.o
Run Code Online (Sandbox Code Playgroud)

任何帮助?提前致谢.

小智 5

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