iclems / iOS-htmltopdf

MIT License
305 stars 79 forks source link

Crash on createPDFWithHTML #19

Closed walsht closed 10 years ago

walsht commented 10 years ago

In iOS 7, getting a looping crash on this call

[NDHTMLtoPDF createPDFWithHTML:emailBody pathForPDF:_targetPath pageSize:kPaperSizeLetter margins:UIEdgeInsetsMake(10, 5, 10, 5) successBlock:^(NDHTMLtoPDF *htmlToPDF) {
                    NSLog(@"Success - %@", htmlToPDF);
                    [self pdfCompleted];
                } errorBlock:^(NDHTMLtoPDF *htmlToPDF) {

                    NSLog(@"Fail - %@", htmlToPDF);
                    if (_failure) {
                        _failure(@"Issue building pdf.  Please try again.");
                    }
                }];

screen shot 2014-01-31 at 9 21 26 am

This was working fine before that last update.

edsonteco commented 10 years ago

Hi! Any update? I have the same problem.

Thanks, Edson.

vshdevelop commented 10 years ago

The problem is in the - (void)loadView method in NDHTMLtoPDF.m. This one actually is a method that UIViewController calls automatically if view is nil. Rename it to e.g. loadTheView and replace occurences of [self loadView] with [self loadTheView]. That worked for me.

henneonrails commented 10 years ago

Yes @vshdevelop fix worked for me too! Thank you.

walsht commented 10 years ago

Worked for me also. Thanks.

iclems commented 10 years ago

Sorry guys, I'll fix this asap

emmychen commented 10 years ago

Got crash too. change - (void)loadView to -(void)loadTheView works. Thanks!