我有一个Cocoa应用程序,它打开一个模态窗口,从ftp服务器加载pdf,然后在PDFView中显示它。我用ARC
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
感谢任何帮助或建议, 拉杜
答案 0 :(得分:0)
我不确定在模态窗口中使用PDFView是否可行。如果在普通窗口中使用相同的代码,它是否有效?