<Error>: FT_Select_Charmap failed: error 6
I have a method where I draw a PDF to a bitmap. Once in a while I see this error in the log when running it on an actual device (not simulator):
<Error>: FT_Select_Charmap failed: 开发者_运维问答error 6
The error is occurring at the marked line (#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);
I see your comment Is This Retained ?? for the GetImageContext... function The answer there is that it goes to an autorelease pool, so if you want to use it elsewhere you should manually retain your pdfImage returned. Check the docs for more info on it. http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIKitFunctionReference/Reference/reference.html
For your main error, can you provide information if it happens for the same file always (is it reproducable 100% on a given PDF?). Then you can tell if it is that specific PDF file or something in the libraries.
精彩评论