2013-10-07 1 views
0

Я использовал этот код:PSPDFKit принимая много времени, чтобы дать сообщение об ошибке `documentRef равна нулю, не может получить pageRef`

NSURL *documentURL= [NSURL fileURLWithPath:aStrPrintPdfPath isDirectory:NO]; 
PSPDFDocument *document = [PSPDFDocument documentWithURL:documentURL]; 

PSPDFViewController *pdfController = [[PSPDFViewController alloc] initWithDocument:document]; 
pdfController.pageTransition = PSPDFPageTransitionCurl; 
pdfController.renderingMode = PSPDFPageRenderingModeFullPageBlocking; 
[pdfController setUpdateSettingsForRotationBlock:^(PSPDFViewController *aPDFController, UIInterfaceOrientation toInterfaceOrientation) { 
    // conditionally set depending on rotation 
    if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) { 
     aPDFController.pageMode = PSPDFPageModeDouble; 
    } else { 
     aPDFController.pageMode = PSPDFPageModeSingle; 
    } 

}]; 

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:pdfController]; 
[self presentViewController:navController animated:YES completion:NULL]; 
pdfController.title = @""; 
[pdfController release]; 
[navController release]; 

Теперь problem оно принимает около 30 to 50 seconds дать эти ошибки: Ошибка: NSError * PSPDFError (NSInteger, NSString * _ сильный, NSError * _autoreleasing *)/35 Ошибка 210: documentRef is nil; cannot get pageRef для страницы 1. hanging my UI completetly и затем opens с pdfController с nothing

ответ

2

это главный разработчик PSPDFKit.

Когда вы получаете «documentRef is no, не можете получить pageRef» - ​​это означает, что источник PDF, используемый для создания PSPDFDocument, является недопустимым. Проверьте свойство isValid на документе, чтобы проверить это программно.

Я не уверен, в какой версии вы находитесь, но как минимум 3.x не блокирует ваш поток пользовательского интерфейса, а просто покажет пустой контроллер просмотра, который ждет вас, чтобы установить другой документ.

0

никогда раньше, б использовали PSPDFViewController ut из ошибки, которую вы получаете, может быть в том случае, если в init можно управлять памятью.

Это совершенно приблизительные предложения, но просто пытается помочь вам:

try removing your pdfcontroller release or adding an autorelease at the end of your init (this probably won't have an effect if you add the autorelease however) 

try creating a @property for your pdfcontroller in your header file and releasing/managing the memory in your viewdidunload method (and maybe even dealloc). 
+0

спасибо, но не вариант. У меня осталось? но его озабоченность PSPDFKit. –

 Смежные вопросы

  • Нет связанных вопросов^_^