iOS 10.0 Beta,键盘扩展:消失的数字键盘(iPhone)

时间:2016-08-12 02:06:06

标签: iphone ios-app-extension custom-keyboard ios10

在适用于iPhone的iOS 10.0 beta 4(XCode 8 beta 5)中,当用户点击数字键盘文本字段或小数点填充文本字段时,会显示系统的数字或小数点,而不是属于键盘扩展名。至少对我的键盘扩展名和Xcode提供的骨架自定义键盘扩展名都是如此。

此外,当用户点击我的测试程序中的Number Pad文本字段或Decimal Pad文本字段时,控制台会显示此消息(这是数字键盘的版本,类型4):

2016-08-11 21:58:43.007 TestNumberPad[34090:1780242] Can't find keyplane that supports type 4 for keyboard iPhone-PortraitChoco-NumberPad; using 1144316255_PortraitChoco_iPhone-Simple-Pad_Default

以下是我的测试程序的结果。默认键盘扩展名应该出现在所有3种情况中。

enter image description here enter image description here

enter image description here

以下是我的3个文本字段

的属性检查器条目的顶部

enter image description here enter image description here

enter image description here

这里是ViewController.swift

import UIKit

class ViewController: UIViewController, UITextFieldDelegate {

  @IBOutlet weak var defaultField: UITextField!  // 'tag' property = 3
  @IBOutlet weak var numberField: UITextField!   // 'tag' property = 4
  @IBOutlet weak var decimalField: UITextField!  // 'tag' property = 5

  override func viewDidLoad() {
    super.viewDidLoad()
    defaultField.delegate = self
    numberField.delegate = self
    decimalField.delegate = self

    // I TRIED AN ALTERNATE TEST, WHERE I SPECIFY THE KEYBOARD TYPE PROGRAMMATICALLY, NOT IN THE IB:
    //
    // 1. IN THE INTERFACE BUILDER, SET ALL 3 KEYBOARD TYPES TO 'DEFAULT'.
    // 2. UNCOMMENT THE CODE BELOW
    //
    // UNFORTUNATELY, THE RESULTS ARE THE SAME
    //
//    defaultField.keyboardType = UIKeyboardType.default
//    numberField.keyboardType = UIKeyboardType.numberPad
//    decimalField.keyboardType = UIKeyboardType.decimalPad
  }

  func textFieldDidBeginEditing(_ textField: UITextField) {
    switch textField.tag {
    case 3: print("Tapped default field")
    case 4: print("Tapped number pad")
    case 5: print("Tapped decimal pad")
    default:
      print("Text field doesn't have a tag!!")
    }
  }
}

最后,按顺序点击默认字段,数字键盘字段和小数点字段时,控制台输出就在这里。

  

Tapped default field 2016-08-12 11:13:08.561083

     

TestNumberPad [2201:221335] [MC]系统组容器   systemgroup.com.apple.configurationprofiles路径是   /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles

     

2016-08-12 11:13:08.563097 TestNumberPad [2201:221335] [MC]阅读   来自公共有效的用户设置。

     

2016-08-12 11:13:08.799888 TestNumberPad [2201:221335] [App]如果我们在真正的预提交中   处理程序我们实际上不能因CA限制而添加任何新的围栏

     

Tapped数字键盘

     

2016-08-12 11:13:15.070750 TestNumberPad [2201:221335]无法找到支持类型4的键盘   用于键盘iPhone-Portrait-NumberPad;运用   160517473_Portrait_iPhone-Simple-Pad_Default

     

Tapped decimal pad

     

2016-08-12 11:13:17.627520 TestNumberPad [2201:221335]无法找到   支持键盘iPhone-Portrait-DecimalPad的8型键盘;   使用405786210_Portrait_iPhone-Simple-Pad_Default

App Store评论指南仍然需要自定义键盘来提供数字键盘和小数位垫,因此这似乎是一个重要问题。

1 个答案:

答案 0 :(得分:0)

我猜你是在模拟器上进行测试,所以当键盘不存在时会在日志中出现这个错误。

所以只需切换键盘或使用设备。