PDFDocument removePageAtIndex for 10.8.4 Exception Raised

时间:2013-06-08 15:46:56

标签: cocoa exception pdf quartz-graphics

我在Mountain Lion 10.8.4中使用PDFDocument得到了一个奇怪的错误,我无法使用removePageAtIndex方法。它总会崩溃。

代码非常简单

    PDFDocument* theOldPDF = [[PDFDocument alloc] initWithURL:[panel URL]];
    [theOldPDF pageCount];
    NSLog(@"[theOldPDF pageCount] : %lu",[theOldPDF pageCount]);
    [theOldPDF removePageAtIndex:1];
    NSLog(@"PAGE REMOVED");

以下是文档打开时引发的异常:

2013-06-08 22:05:59.120 test pdf remove crash[3978:303] [theOldPDF pageCount] : 10
2013-06-08 22:05:59.124 test pdf remove crash[3978:303] -[__NSCFNumber annotations]: unrecognized selector sent to instance 0x187
2013-06-08 22:05:59.128 test pdf remove crash[3978:303] An uncaught exception was raised
2013-06-08 22:05:59.128 test pdf remove crash[3978:303] -[__NSCFNumber annotations]: unrecognized selector sent to instance 0x187
2013-06-08 22:05:59.132 test pdf remove crash[3978:303] (
    0   CoreFoundation                      0x00007fff99048b06 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff920c23f0 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff990df40a -[NSObject(NSObject) does    NotRecognizeSelector:] + 186
    3   CoreFoundation                      0x00007fff9903702e ___forwarding___ + 414
    4   CoreFoundation                      0x00007fff99036e18 _CF_forwarding_prep_0 + 232
    5   PDFKit                              0x00007fff936e1fde -[PDFDocument removePageAtIndex:] + 408
    6   test pdf remove crash               0x00000001000013fc -[AppDelegate openDocument:] + 476

如日志所示,PDF有10页,我试图删除第一页,(或其中任何一个),它会崩溃。

有人已经遇到过这种问题吗?这只发生在10.8.4,到目前为止工作正常。

由于

1 个答案:

答案 0 :(得分:0)

这里提出了一个临时但功能性的解决方法: http://openradar.appspot.com/14081212