从某些UIView创建PDF会导致崩溃

时间:2012-07-13 04:13:44

标签: ios pdf-generation

我一直在尝试将某些UIViews保存为PDF,在某些情况下它会崩溃..请注意特定UIView上的崩溃。在这段代码中,崩溃开始于UIGraphicsEndPDFContext我在这里做错了什么?..这使得错误在一些UIViews上不一致?

   NSMutableData *pdfData = [NSMutableData data];

        UIGraphicsBeginPDFContextToData(pdfData,CGRectMake(0, 0, 0,0   ), nil);
        // Points the pdf converter to the mutable data object and to the UIView to be converted


        // draws rect to the view and thus this is captured by UIGraphicsBeginPDFContextToData
        [contentViews enumerateKeysAndObjectsUsingBlock: // Enumerate content views
         ^(id key, id object, BOOL *stop) {

             ReaderContentView *contentView = object;

             UIGraphicsBeginPDFPage();
             CGContextRef pdfContext = UIGraphicsGetCurrentContext();

             [contentView.theContentView.layer renderInContext:pdfContext];

         }];    

        UIGraphicsEndPDFContext();

崩溃在第一行

0x33e69884:  ldr    r2, [r0], #4
0x33e69888:  beq    0x33e6989c               ; strlen + 36

谢谢你们!

0 个答案:

没有答案