Issues with keyplane, leaks, and snapshotting
agirault opened this issue · comments
Alexis Girault commented
Using Swift 4.2, iOS 12.0:
Sample code:
In the UIViewController
holding the PinCodeTextField:
viewDidLoad() {
super.viewDidLoad()
pinCodeTextField.allowedCharacterSet = CharacterSet.decimalDigits
pinCodeTextField.keyboardType = UIKeyboardType.numberPad
pinCodeTextField.font = UIFont(name: "CustomFont", size: 20.0) ?? UIFont.systemFont(ofSize: 20)
pinCodeTextField.underlineColor = UIColor.customColor
pinCodeTextField.updatedUnderlineColor = UIColor.customColor
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
pinCodeTextField.text = ""
pinCodeTextField.becomeFirstResponder()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
pinCodeTextField.resignFirstResponder()
}
In AppDelegate
:
func applicationWillResignActive(_ application: UIApplication) {
// Hide keyboard in background
window?.endEditing(true)
}
Errors are:
- When calling
pinCodeField.becomeFirstResponder()
:
Can't find keyplane that supports type 4 for keyboard iPhone-PortraitTruffle-NumberPad; using 20615_PortraitTruffle_iPhone-Simple-Pad_Default
Seems to be due to using UIKeyboardType.numberPad
, but I do need the number pad, and the funny thing is that the app does show the number pad properly and not the default pad:
- Also when calling
pinCodeField.becomeFirstResponder()
, I get 6 leaks:
Malloc 32 Bytes QuartzCore CA::AttrList::set(unsigned int, _CAValueType, void const*)
UIKeyboardPredictionView 688 Bytes UIKitCore +[UIKeyboardPredictionView sharedInstance]
Malloc 16 Bytes QuartzCore CA::Layer::setter(unsigned int, _CAValueType, void const*)
CALayer 32 Bytes QuartzCore +[CALayer allocWithZone:]
Malloc 288 Bytes QuartzCore -[CALayer init]
Malloc 16 Bytes QuartzCore CA::AttrList::Node::alloc_memory(_CAValueType)
- When going in the background:
[Snapshotting] Snapshotting a view (0x150810200, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES.
It seems that calling endEditing
or resignFirstResponder
while the app goes in the background causes this issue.