Can't find keyplane that supports type 4 for keyboard iPhone-Portrait-NumberPad; using 3876877096_Portrait_iPhone-Simple-Pad_Default

CRAZYSNAKE picture CRAZYSNAKE · Sep 15, 2014 · Viewed 124.3k times · Source

I've downloaded iOS 8 Gold Master for the iPhone and the SDK.

I tested the app and it works fine, except for one thing.

I have a text field where a number pad will appear if the user wants to type something, in addition, a custom button is added to the empty area when the keyboard shows up.

- (void)addButtonToKeyboard
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
    {
        // create custom button
        UIButton * doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
        doneButton.frame = CGRectMake(-2, 163, 106, 53);
        doneButton.adjustsImageWhenHighlighted = NO;
        [doneButton setImage:[UIImage imageNamed:@"DoneUp.png"] forState:UIControlStateNormal];
        [doneButton setImage:[UIImage imageNamed:@"DoneDown.png"] forState:UIControlStateHighlighted];
        [doneButton addTarget:self action:@selector(saveNewLead:) forControlEvents:UIControlEventTouchUpInside];

        // locate keyboard view
        UIWindow * tempWindow = [[[UIApplication sharedApplication] windows]objectAtIndex:1];
        UIView* keyboard;
        for(int i=0; i<[tempWindow.subviews count]; i++) 
        {
            keyboard = [tempWindow.subviews objectAtIndex:i];

            // keyboard view found; add the custom button to it
            if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 3.2) {
                if([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES)
                    [keyboard addSubview:doneButton];
            } else {
                if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES)
                    [keyboard addSubview:doneButton];
            }
        }
    }

}

This was working fine up till now.

First of all, I'm getting this warning:

Can't find keyplane that supports type 4 for keyboard iPhone-Portrait-NumberPad; using 3876877096_Portrait_iPhone-Simple-Pad_Default

then that custom button is also not showing, which I think because of these 2 lines:

if([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES)

and

if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES)

Any suggestions?

Answer

aquagremlin picture aquagremlin · Sep 21, 2014

I too had this problem after updating to the latest Xcode Beta. The settings on the simulator are refreshed, so the laptop (external) keyboard was being detected. If you simply press:

iOS Simulator -> Hardware -> Keyboard -> Connect Hardware Keyboard

so that the entry is UNchecked then the software keyboard will be displayed once again.