This is a shipping app that ran fine under iOS 7. Just started iOS 8 testing and the custom keyboard that's necessary to enter data in one view crashes when it's attached to a UITextView or UITextField. The actual error is an invalid orientation for an app that should be portrait only.
* Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [UICompatibilityInputViewController shouldAutorotate] is returning YES'
So it appears the crash is occurring when an iOS 8 "compatibility" controller that is somehow in the mix is returning YES from shouldAutorotate, when it should be returning NO.
My app is targeted to iPhone only, it's only supported orientation in the project/plist settings is portrait, the main view NavController enforces this with the following code
-(BOOL)shouldAutorotate
{
return NO;
}
- (UIBarPosition)positionForBar:(id<UIBarPositioning>)bar
{
return UIBarPositionTop;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
Every view controller, including the view controller for the custom keyboard returns NO from shouldAutoRotate. I've verified shouldAutoRotate is getting called for the custom keyboard controller, and the crash occurs directly afterwards.
The one weird oddity is that the shouldAutoRotate method is NOT getting called for the controller for the view the custom keyboard is displayed in.
The custom keyboard view is attached to the textView by that parent view controller when textViewShouldBeginEditing is called for the specific textView that needs the custom keyboard.
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView {
if (textView == self.rangeText) {
[self showKeyboard];
textView.inputView = keyboardView;
textView.inputAccessoryView = keyboardView;
[keyController setTextView: textView];
keyController.maxCards = maxCards;
activeTextField = nil;
}
return YES;
}
- (void) showKeyboard {
if (!keyboardView) {
[self createCustomKeyboard];
}
// Restore frame if it got wierd.
[keyboardView setFrame: keyboardFrame];
[keyboardView setHidden: NO];
[keyboardView becomeFirstResponder];
}
- (void) createCustomKeyboard {
keyboardView = [[CardsInputView alloc] initWithFrame: self.view.frame];
keyController = (CardsInputController *) [keyboardView nextResponder];
errCheckNil(keyController);
keyController.view = keyboardView;
if (!keyFrameSet) {
keyboardFrame = keyboardView.frame;
keyFrameSet = YES;
}
}