【发布时间】:2012-01-28 20:38:13
【问题描述】:
我在 iPad Storage 上有一个带有我的 pdf 文件地址的 URL:
/Library/Application%20Support/iPhone%20Simulator/5.0/Applications/78AB0683-5B3F-4AD6-83BB-236D9623574B/Library/Caches/Newsstand/953C71E3-CED3-4369-993F-9132119269EC/
然后我有将这个地址放入 NSURL 的函数:
-(void)readIssue:(Issue *)issue {
urlOfReadingIssue=[[issue contentURL] URLByAppendingPathComponent:@"magazine.pdf"];
在这段代码之上,我有 de VFR-Reader 代码来从这个 URL 加载这个文件。 Reader Demo的原始代码是:
NSString *phrase = nil; // Document password (for unlocking most encrypted PDF files)
NSArray *pdfs = [[NSBundle mainBundle] pathsForResourcesOfType:@"pdf" inDirectory:nil];
NSString *filePath = [pdfs lastObject]; assert(filePath != nil); // Path to last PDF file
ReaderDocument *document = [ReaderDocument withDocumentFilePath:filePath password:phrase];
if (document != nil) // Must have a valid ReaderDocument object in order to proceed with things
{
ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document];
readerViewController.delegate = self; // Set the ReaderViewController delegate to self
if (DEMO_VIEW_CONTROLLER_PUSH == TRUE)
[self.navigationController pushViewController:readerViewController animated:YES];
#else // present in a modal view controller
readerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
readerViewController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:readerViewController animated:YES];
#endif // DEMO_VIEW_CONTROLLER_PUSH
[readerViewController release]; // Release the ReaderViewController
}
我的最终代码是:
-(void)readIssue:(Issue *)issue {
urlOfReadingIssue=[[issue contentURL] URLByAppendingPathComponent:@"magazine.pdf"];
NSString *phrase = nil; // Document password (for unlocking most encrypted PDF files)
NSString *filePath = urlOfReadingIssue;
ReaderDocument *document = [ReaderDocument withDocumentFilePath:filePath
password:phrase];
if (document != nil) // Must have a valid ReaderDocument object in order to proceed with things
{
ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document];
readerViewController.delegate = self; // Set the ReaderViewController delegate to self
#if (DEMO_VIEW_CONTROLLER_PUSH == TRUE)
[self.navigationController pushViewController:readerViewController animated:YES];
#else // present in a modal view controller
readerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
readerViewController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:readerViewController animated:YES];
#endif // DEMO_VIEW_CONTROLLER_PUSH
[readerViewController release]; // Release the ReaderViewController
}
但是当我构建时,我在 @autoreleasepool 上的 AppDelegate.m 中收到一个线程错误“SIGABIT”:
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
我看不到这里发生了什么。在谷歌上搜索,我读到了这个错误。 “SIGABRT”似乎是来自 xcode 的错误。
我已经花了好几个小时了,如果有更多 VFR-Reader 经验的人能最好地指导我解决这个错误,我将不胜感激。
【问题讨论】:
-
请注意,您提出了 12 个问题,但未接受任何答案。这可能会使人们不愿回答您的问题。
-
你确定是 SIGABIT,而不是 SIGABRT?
-
对不起,它真的是 SIGABRT。我编辑了问题。
标签: objective-c pdf