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

后端 未结 2 748
时光取名叫无心
时光取名叫无心 2021-01-15 04:26

I am writing an app with 3 viewControllers contained inside of a MainViewController. One of these is controlled through the storyboard and shows ads. The other two viewContr

相关标签:
2条回答
  • 2021-01-15 04:59

    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.

    0 讨论(0)
  • 2021-01-15 05:21

    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.

    0 讨论(0)
提交回复
热议问题