我有一个 Cocoa 应用程序,它打开一个模式窗口,从 ftp 服务器加载加载 pdf,并将其显示在 PDFView 中。我用弧
PDFViewerWindowController *pdfViewerWindowController = [[PDFViewerWindowController alloc] initWithWindowNibName:@"PDFViewerWindow"];
[pdfViewerWindowController setDocumentForUrl:url];
[NSApp runModalForWindow:[pdfViewerWindowController window]];
这是 setDocumentForUrl:
-(void)setDocumentForUrl:(NSString *)url
{
NSString *urlString = [NSString stringWithFormat:@"ftp://192.168.32.11%@", url];
pdfDoc = [[PDFDocument alloc] initWithURL:[NSURL URLWithString:urlString]];
[pdfView setDocument: pdfDoc];
}
我收到此错误(并非总是发生):
Crashed Thread: 4
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: 0x000000000000000d, 0x0000000000000000
Thread 4 Crashed:
0 libobjc.A.dylib 0x00007fff95626e90 objc_msgSend + 16
1 com.apple.PDFKit 0x00007fff972fadfc -[PDFView dealloc] + 48
2 com.apple.Foundation 0x00007fff96d66401 -[NSConcreteNotification dealloc] + 61
3 com.apple.CoreFoundation 0x00007fff8edf3ab0 CFRelease + 176
4 com.apple.CoreFoundation 0x00007fff8ee1bf90 -[__NSArrayM dealloc] + 304
5 com.apple.Foundation 0x00007fff96ddace3 -[NSNotificationQueue _flushNotificationQueue] + 84
6 com.apple.Foundation 0x00007fff96ddac51 -[NSNotificationQueue dealloc] + 27
7 com.apple.CoreFoundation 0x00007fff8edf3ab0 CFRelease + 176
8 com.apple.CoreFoundation 0x00007fff8ee5c8a7 CFRunLoopObserverInvalidate + 295
9 com.apple.CoreFoundation 0x00007fff8ee5cc14 __CFRunLoopObserverDeallocate + 20
10 com.apple.CoreFoundation 0x00007fff8edf3bf6 CFRelease + 502
11 com.apple.CoreFoundation 0x00007fff8ee5915b __CFRunLoopDeallocateObservers + 235
12 com.apple.CoreFoundation 0x00007fff8edfd2d2 __CFSetApplyFunction_block_invoke_1 + 18
13 com.apple.CoreFoundation 0x00007fff8edfd121 CFBasicHashApply + 113
14 com.apple.CoreFoundation 0x00007fff8edfd0a4 CFSetApplyFunction + 212
15 com.apple.CoreFoundation 0x00007fff8ee58c0f __CFRunLoopDeallocate + 127
16 com.apple.CoreFoundation 0x00007fff8edf3bf6 CFRelease + 502
17 com.apple.CoreFoundation 0x00007fff8ee36c80 __CFTSDFinalize + 96
18 libsystem_c.dylib 0x00007fff94b1e942 _pthread_tsd_cleanup + 230
19 libsystem_c.dylib 0x00007fff94ad9f7c _pthread_exit + 142
20 libsystem_c.dylib 0x00007fff94ada59e _pthread_wqthread + 768
21 libsystem_c.dylib 0x00007fff94adbb85 start_wqthread + 13
任何帮助或建议表示赞赏,Radu