키보드 iPhone-Portrait-NumberPad에 유형 4를 지원하는 키 플레인을 찾을 수 없습니다. 3876877096_Portrait_iPhone-Simple-Pad_Default 사용
iPhone 및 SDK 용 iOS 8 Gold Master를 다운로드했습니다.
나는 응용 프로그램을 테스트했으며 한 가지를 제외하고는 잘 작동합니다.
사용자가 무언가를 입력하려는 경우 숫자 패드가 표시되는 텍스트 필드가 있으며 키보드가 표시되면 빈 영역에 사용자 정의 버튼이 추가됩니다.
- (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];
}
}
}
}
이것은 지금까지 잘 작동했습니다.
우선, 나는이 경고를 받고 있습니다 :
키보드 iPhone-Portrait-NumberPad에 유형 4를 지원하는 키 플레인을 찾을 수 없습니다. 3876877096_Portrait_iPhone-Simple-Pad_Default 사용
그런 다음 맞춤 버튼도 표시되지 않습니다.이 두 줄 때문에 생각합니다.
if([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES)
과
if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES)
어떤 제안?
나는 또한이 문제가 있었고 해결책을 찾았습니다.
아래는 iOS 8.0 및 아래 버전에서 작동하는 코드입니다.
iOS 7 및 8.0 (Xcode 버전 6.0.1)에서 테스트했습니다.
- (void)addButtonToKeyboard
{
// create custom button
self.doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
//This code will work on iOS 8.3 and 8.4.
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.3) {
self.doneButton.frame = CGRectMake(0, [[UIScreen mainScreen] bounds].size.height - 53, 106, 53);
} else {
self.doneButton.frame = CGRectMake(0, 163+44, 106, 53);
}
self.doneButton.adjustsImageWhenHighlighted = NO;
[self.doneButton setTag:67123];
[self.doneButton setImage:[UIImage imageNamed:@"doneup1.png"] forState:UIControlStateNormal];
[self.doneButton setImage:[UIImage imageNamed:@"donedown1.png"] forState:UIControlStateHighlighted];
[self.doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];
// locate keyboard view
int windowCount = [[[UIApplication sharedApplication] windows] count];
if (windowCount < 2) {
return;
}
UIWindow *tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
UIView *keyboard;
for (int i = 0; i < [tempWindow.subviews count]; i++) {
keyboard = [tempWindow.subviews objectAtIndex:i];
// keyboard found, add the button
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.3) {
UIButton *searchbtn = (UIButton *)[keyboard viewWithTag:67123];
if (searchbtn == nil)
[keyboard addSubview:self.doneButton];
} else {
if([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES) {
UIButton *searchbtn = (UIButton *)[keyboard viewWithTag:67123];
if (searchbtn == nil)//to avoid adding again and again as per my requirement (previous and next button on keyboard)
[keyboard addSubview:self.doneButton];
} //This code will work on iOS 8.0
else if([[keyboard description] hasPrefix:@"<UIInputSetContainerView"] == YES) {
for (int i = 0; i < [keyboard.subviews count]; i++)
{
UIView *hostkeyboard = [keyboard.subviews objectAtIndex:i];
if([[hostkeyboard description] hasPrefix:@"<UIInputSetHost"] == YES) {
UIButton *donebtn = (UIButton *)[hostkeyboard viewWithTag:67123];
if (donebtn == nil)//to avoid adding again and again as per my requirement (previous and next button on keyboard)
[hostkeyboard addSubview:self.doneButton];
}
}
}
}
}
}
>
- (void)removedSearchButtonFromKeypad
{
int windowCount = [[[UIApplication sharedApplication] windows] count];
if (windowCount < 2) {
return;
}
UIWindow *tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
for (int i = 0 ; i < [tempWindow.subviews count] ; i++)
{
UIView *keyboard = [tempWindow.subviews objectAtIndex:i];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.3){
[self removeButton:keyboard];
} else if([[keyboard description] hasPrefix:@"<UIPeripheralHost"] == YES) {
[self removeButton:keyboard];
} else if([[keyboard description] hasPrefix:@"<UIInputSetContainerView"] == YES){
for (int i = 0 ; i < [keyboard.subviews count] ; i++)
{
UIView *hostkeyboard = [keyboard.subviews objectAtIndex:i];
if([[hostkeyboard description] hasPrefix:@"<UIInputSetHost"] == YES) {
[self removeButton:hostkeyboard];
}
}
}
}
}
- (void)removeButton:(UIView *)keypadView
{
UIButton *donebtn = (UIButton *)[keypadView viewWithTag:67123];
if(donebtn) {
[donebtn removeFromSuperview];
donebtn = nil;
}
}
도움이 되었기를 바랍니다.
그러나 여전히이 경고가 나타납니다.
Can't find keyplane that supports type 4 for keyboard iPhone-Portrait-NumberPad; using 3876877096_Portrait_iPhone-Simple-Pad_Default
Ignoring this warning, I got it working. Please, let me know if you able to get relief from this warning.
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.
The emulator tries to find a numeric keypad on the mac, but this is not found (MacBook Pro, MacBook Air and "normal/small" keyboard do not have it). You can deselect the option Connect Hardware Keyboard or just ignore the error message, it will have no negative effect on application.
I am using xcode with ios 8 just uncheck the connect harware keyboard option in your Simulator-> Hardware-> Keyboard-> Connect Hardware Keyboard.
This will solve the issue.
Just Go to
iOS Simulator -> Hardware -> Keyboard -> Uncheck the Connect Hardware Keyboard Option.
This will fix the issue.
Your MAC keyboard will not work after performing the above step, You have to use simulator keyboard.
I had the same problem in Xcode 8.1 and iOS 10.1. What worked for me was going into Simulator-> Hardware->Keyboard and unchecking Connect Hardware Keyboard.
Run the app using the simulator
iOS Simulator-> Hardware-> Keyboard -> iOS uses same layout as OS X
This will fix the issue if anyone out there is running their app on their device
Go into Simulator-> Hardware->Keyboard and unchecking Connect Hardware Keyboard.
The same as many answers above BUT did not change for me until I quit and restart the simulator. xcode 8.2.1 and Simulator 10.0.
I got the same error message for two separate reasons, so you can add them to your debugging checklist:
Context: Xcode 6.4, iOS:8.4. I was adding a toolbar with custom UIBarButton
s to load with the UIKeyboardTypeNumberPad
(Swift: UIKeyboardType.numberPad
) , namely "Done" and "+/-". I had this problem when:
My UIToolbar was declared as a property, but I had forgotten to explicitly alloc/init it.
I had left off the last line,
[myCustomToolbar sizeToFit];
, which sounds like it's the same family as Holden's answer (my code here: https://stackoverflow.com/a/32016397/4898050).
Good luck
I had the same problem using distribution provisioning profile. Check that you use developer profile
Why the long code and not use the UIToolbar? since the warning is still persist?
UIToolbar is working for any iOS Version here's my sample code
UIToolbar *doneToolbar = [[UIToolbar alloc] initWithFrame:(CGRect){0, 0, 50, 50}]; // Create and init
doneToolbar.barStyle = UIBarStyleBlackTranslucent; // Specify the preferred barStyle
doneToolbar.items = @[
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
[[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:self action:@selector(doneEditAction)] // Add your target action
]; // Define items -- you can add more
yourField.inputAccessoryView = doneToolbar; // Now add toolbar to your field's inputview and run
[doneToolbar sizeToFit]; // call this to auto fit to the view
- (void)doneEditAction {
[self.view endEditing:YES];
}
In your iOS App can't find a Numeric Keypad attached to your OS X. So you just need to Uncheck connect Hardware Keyboard option in your Simulator, in the following path just for testing purpose:
Simulator -> Hardware -> Keyboard -> Connect Hardware Keyboard
This will resolve the above issue.
I think you should see the below link too. It says it's a
bug
in theXCode
at the end of that Forum post thread!
Maybe you should reset frame of the button, I had some problem too, and nslog the view of keyboard like this:
ios8:
"<UIInputSetContainerView: 0x7fef0364b0d0; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x7fef0364b1e0>>"
before8:
"<UIPeripheralHostView: 0x11393c860; frame = (0 352; 320 216); autoresizesSubviews = NO; layer = <CALayer: 0x11393ca10>>"
Okay here's a simple fix for getting 'done' button to show and work in an app in both iOS 9, iOS 8 and below when I got similar error. It could be observed after running an app and viewing it via 'View's Hierarchy' (i.e. clicking on the 'View Hierarchy' icon from Debug Area bar while app is running on device and inspecting your views in Storyboard), that the keyboard is presented on different windows in iOS 9 compared to iOS 8 and below versions and have to be accounted for. addButtonToKeyboard
- (id)addButtonToKeyboard
{
if (!doneButton)
{
// 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];
}
NSArray *windows = [[UIApplication sharedApplication] windows];
//Check to see if running below iOS 9,then return the second window which bears the keyboard
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 9.0) {
return windows[windows.count - 2];
}
else {
UIWindow* keyboardWithDoneButtonWindow = [ windows lastObject];
return keyboardWithDoneButtonWindow;
}
}
And this is how you could removeKeyboardButton from keyboard if you want.
- (void)removeKeyboardButton {
id windowTemp = [self addButtonToKeyboard];
if (windowTemp) {
for (UIView *doneButton in [windowTemp subviews]) {
if ([doneButton isKindOfClass:[UIButton class]]) {
[doneButton setHidden:TRUE];
}
}
}
}
'programing tip' 카테고리의 다른 글
주어진 Type이 Enum인지 확인 (0) | 2020.08.05 |
---|---|
Android Studio 프로젝트 구조 (vs Eclipse 프로젝트 구조) (0) | 2020.08.05 |
파이썬에서 type == list 여부 확인 (0) | 2020.08.05 |
C #에서 HTML 이메일 본문 생성 (0) | 2020.08.05 |
람다를 사용하여 여러 열로 그룹화 (0) | 2020.08.05 |