iOS11 objective-c 问题 'unrecognized selector sent to instance' 调用自定义 class 存在的方法

iOS11 objective-c issue 'unrecognized selector sent to instance' calling a method that exist of a custom class

iOS 升级到 iOS11,我的 PDF reader 停止工作,应用程序崩溃,因为无法识别选择器调用所有 属性 对象

@interface PDFScrollView : UIScrollView <UIScrollViewDelegate>
// Frame of the PDF
@property (nonatomic) CGRect pageRect;
// A low resolution image of the PDF page that is displayed until the TiledPDFView renders its content.
@property (nonatomic, strong) UIView *backgroundImageView;
// The TiledPDFView that is currently front most.
@property (nonatomic, strong) TiledPDFView *tiledPDFView;
// The old TiledPDFView that we draw on top of when the zooming stops.
@property (nonatomic, strong) TiledPDFView *oldTiledPDFView;
// Current PDF zoom scale.
@property (nonatomic) CGFloat scale;
@property (nonatomic) CGPDFPageRef PDFPage;

-(void)replaceTiledPDFViewWithFrame:(CGRect)frame;

@end

如果我尝试获取或设置比例或 PDFPagetiledPDFView

我遇到了无法识别的错误:

 -[PDFScrollView tiledPDFView]: unrecognized selector sent to instance 0x7fd3d28dbc00
-[PDFScrollView tiledPDFView]: unrecognized selector sent to instance 0x7fd3d28dbc00
(null)

class的一些细节:

@interface PDFScrollView : UIScrollView <UIScrollViewDelegate>

    @property (nonatomic) CGRect pageRect;
    @property (nonatomic, strong) UIView *backgroundImageView;
    @property (nonatomic, strong) TiledPDFView *tiledPDFView;
    @property (nonatomic, strong) TiledPDFView *oldTiledPDFView;

我认为这是一个 iOS11 错误,我该如何修复它??

我们遇到了类似的问题。我们的例外是:

-[PDFPasswordViewController setPdfURL:]: unrecognized selector sent to instance 0x101479240

你不会相信这一点,但我们已经将 class 名称更改为不以 "PDF" 开头的名称。

以前是 PDFPasswordViewController,我们添加了一个前缀,例如 XXPDFPasswordViewController。就是这样,现在它像以前一样工作了。

老实说,我们不知道是什么原因造成的,但我们认为这可能与 iOS 11.

中引入的 PDFKit 有关。