My app has recently (iOS 11) started crashing when a custom UIViewController is loaded:
The crash occurs at the line:
PDFViewController *pdfvc = [self.storyboard instantiateViewControllerWithIdentifier:@"PDFView"];
PDFViewController
PDFView
[PDFViewController initWithCoder:]: unrecognized selector sent to instance 0x1c0012320
2017-09-26 22:35:44.578082+0900 flightcomp[9764:3233421] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PDFViewController initWithCoder:]: unrecognized selector sent to instance 0x1c0012320'
@interface PDFViewController : UIViewController <UIPrintInteractionControllerDelegate>
@implementation PDFViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
https://i.stack.imgur.com/BSneC.png
The issue is that Apple as of iOS 11 has now included PDFKit as a framework. I believe that PDFViewController is now a reserved name for this framework. I had the same issue and after changing PDFViewController to SuperDuperPDFViewController worked just fine.