-[UIViewController _keyboard]: unrecognized selector sent to instance 0x7b731ac0

我只是一个虾纸丫 提交于 2019-12-01 10:44:14

I'm going to assume this code works flawlessly when running on an iOS7 device and probably when compiled against the iOS7 SDK on an iOS8 device.

You appear to have had the misfortune of naming one of your properties the same thing as an Apple added property:

@interface UIResponder (UIResponderInputViewAdditions)
// Called and presented when object becomes first responder.  Goes up the responder     chain.
@property (nonatomic, readonly, retain) UIInputViewController *inputViewController NS_AVAILABLE_IOS(8_0);
@end

When the user taps on your text field, UIKit will grab your view controller thinking it's a UIInputViewController and send the private message _keyboard. Your view controller doesn't implement this method and it crashes the app.

The only thing you need to do here is rename your property from inputViewController to something else like myInputViewController.

The problem is in your iPad storyboard. Check all the view controllers' connections. You might have a connection in the storyboard that doesn't get use, delete them. It has got to be there if it works on iPhone and not the iPad. Place breakpoints everywhere to see the last position before crash.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!