我正在将 Xcode 9.4 与 Objective C 一起使用。我想按照以下代码使用 PDFView 显示 pdf 文件
PDFView * pdfView = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
NSString* path = [[NSBundle mainBundle] pathForResource:@"abc" ofType:@"pdf"];
NSData* data = [NSData dataWithContentsOfFile:path];
PDFDocument *pdfDocument = [[PDFDocument alloc] initWithData:data];
[pdfView setDocument:pdfDocument];
但它与 SetDocument 无法识别的选择器实例以及以下错误一起失败。
错误:
-[PDFView setDocument:]:无法识别的选择器发送到实例 0x101367c40
错误:执行被中断,原因:尝试取消引用无效的 ObjC 对象或向其发送无法识别的选择器。该过程已返回到表达式评估之前的状态。
我无法确定确切的问题,请帮助。
谢谢你。