实现PSPDFKit

时间:2011-09-26 04:42:38

标签: objective-c cocoa-touch pdf pspdfkit

我正在开展一个项目,该项目可以查看从互联网上提取的PDF文件。我正在使用UIWebView,但之后我切换到PSPDFKit,因为它看起来好多了,还有其他功能。当我使用下面的代码时,视图会加载,但PDF不会。

[self setSelectedObject:(CateRegulations*)[[theDictionary valueForKey:[[[self.theDictionary allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]objectAtIndex:indexPath.section-1]] objectAtIndex:indexPath.row]];
NSString *path = selectedObject.url;
PSPDFDocument *document = [PSPDFDocument PDFDocumentWithUrl:[NSURL fileURLWithPath:path]];
PSPDFViewController *objPdfViewController=[[PSPDFViewController alloc] initWithDocument:document];


[self.navigationController pushViewController:objPdfViewController animated:YES];
[objPdfViewController release];

我的调试器内容如下:

2011-09-25 21:06:29.494 Project[4509:12b03] Error: -[PSPDFDocument rectBoxForPage:]/224 Warning: Returning empty rect.
2011-09-25 21:06:29.495 Project[4509:12b03] Error: -[PSPDFPage displayDocument:page:pageRect:scale:]/92 Warning: Invalid page rect given: {{0, 0}, {0, 0}}
2011-09-25 21:06:29.495 Project[4509:12b03] Error: -[PSPDFViewController scrollToPage:animated:hideHUD:]/1027 Error: Cannot scroll outside boundaries(0), scrolling to last page.
2011-09-25 21:06:29.495 Project[4509:14503] Error: -[PSPDFCache enqueueItem:]/608 Warning: Page is invalid: 0 (pageCount: 0)
2011-09-25 21:06:29.498 Project[4509:12b03] Error: -[PSPDFDocument rectBoxForPage:]/224 Warning: Returning empty rect.
2011-09-25 21:06:29.498 Project[4509:12b03] Error: -[PSPDFPage displayDocument:page:pageRect:scale:]/92 Warning: Invalid page rect given: {{0, 0}, {0, 0}}
2011-09-25 21:06:29.498 Project[4509:12b03] Error: -[PSPDFViewController scrollToPage:animated:hideHUD:]/1027 Error: Cannot scroll outside boundaries(0), scrolling to last page.
2011-09-25 21:06:29.498 Project[4509:14503] Error: -[PSPDFCache enqueueItem:]/608 Warning: Page is invalid: 0 (pageCount: 0)
2011-09-25 21:06:29.531 Project[4509:14503] Error: -[PSPDFDocument pathForPage:]/303 Warning: Path for page 0 is missing!
2011-09-25 21:06:29.532 Project[4509:14503] Error: -[PSPDFGlobalLock openPDFDocumentWithPath:]/50 Error: pdfPath is nil!
2011-09-25 21:06:29.532 Project[4509:14503] Error: -[PSPDFGlobalLock openPDFWithPath:page:]/89 Error: As pdfDocument is nil, aquiring pageRef failed.
2011-09-25 21:06:29.532 Project[4509:14503] Error: -[PSPDFTilingView drawLayer:inContext:]/208 Missing PDF IMAGE FOR <PSPDFDocument uid:2100.2A.pdf files:1 pageCount:0>
2011-09-25 21:06:30.495 Project[4509:18803] Error: __45-[PSPDFCache cacheDocument:startAtPage:size:]_block_invoke_0/802 Warning: startPage:0 to high, resetting to 1.
2011-09-25 21:06:30.496 Project[4509:18803] Error: -[PSPDFCache enqueueItem:]/608 Warning: Page is invalid: 1 (pageCount: 0)
2011-09-25 21:06:30.496 Project[4509:18803] Error: -[PSPDFCache enqueueItem:]/608 Warning: Page is invalid: 0 (pageCount: 0)
2011-09-25 21:06:31.499 Project[4509:18803] Error: __45-[PSPDFCache cacheDocument:startAtPage:size:]_block_invoke_0/802 Warning: startPage:0 to high, resetting to 1.
2011-09-25 21:06:31.500 Project[4509:18803] Error: -[PSPDFCache enqueueItem:]/608 Warning: Page is invalid: 1 (pageCount: 0)
2011-09-25 21:06:31.500 Project[4509:18803] Error: -[PSPDFCache enqueueItem:]/608 Warning: Page is invalid: 0 (pageCount: 0)

1 个答案:

答案 0 :(得分:0)

检查你的网址可能是空的