2010-06-01 92 views
2

我有一种方法,我将PDF绘制到位图。 偶尔我看到此错误日志中的实际设备上运行时,它(未仿真器):<Error>:FT_Select_Charmap失败:错误6

<Error>: FT_Select_Charmap failed: error 6 

误差以标记线(#11)产生:

NSURL *url = [NSURL fileURLWithPath:pdfFilePath]; 
CGPDFDocumentRef documentRef = CGPDFDocumentCreateWithURL((CFURLRef)url); 
CGPDFPageRef pageRef = CGPDFDocumentGetPage(documentRef, 1); 
UIGraphicsBeginImageContext(frame.size); 
CGContextRef ctx = UIGraphicsGetCurrentContext(); 
CGContextSetRGBFillColor(ctx, 1.0, 1.0, 1.0, 1.0); 
CGContextFillRect(ctx, CGContextGetClipBoundingBox(ctx)); 
CGContextTranslateCTM(ctx, 0.0, frame.size.height); 
CGContextScaleCTM(ctx, 1.0, -1.0); 
CGContextConcatCTM(ctx, CGPDFPageGetDrawingTransform(pageRef, kCGPDFCropBox, frame, 0, true)); 
CGContextDrawPDFPage(ctx, pageRef); // ERROR HERE 
UIImage *pdfImage = UIGraphicsGetImageFromCurrentImageContext(); // Is this retained??? 
UIGraphicsPopContext(); 
CGPDFDocumentRelease(documentRef); 
+0

你有没有想过这个? – 2011-01-24 23:04:04

+0

有趣的是,我刚刚得到了这个(运行4.3.2模拟器,虽然我已经在一个单独的目录中安装了5.0 beta 5 sdk,但我使用scode-select将它们分开):':ITVSLW + Wingdings2:FT_Select_Charmap失败:错误38.注意 - 当这种情况发生时,我的代码没有使用任何CGGraphicContexts;它或多或少都是核心数据。 – 2011-08-10 19:04:28

+0

你是如何解决这个问题的?我面临着同样的问题。 – iOSDev 2013-03-07 05:33:37

回答

0

我看到你的评论是这个保留?对于GetImageContext ...函数 答案是它会转到autorelease池,所以如果你想在其他地方使用它,你应该手动保留你的pdfImage返回。查看文档以获取更多信息。 http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIKitFunctionReference/Reference/reference.html

对于你的主要错误,你是否可以提供信息,如果它总是发生在同一个文件上(它是否可以在给定PDF上100%重现?)。然后你可以知道它是否是特定的PDF文件或库中的某个东西。