Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with keyplane, leaks, and snapshotting #45

Open
agirault opened this issue Nov 27, 2018 · 0 comments
Open

Issues with keyplane, leaks, and snapshotting #45

agirault opened this issue Nov 27, 2018 · 0 comments

Comments

@agirault
Copy link

agirault commented Nov 27, 2018

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:

  1. 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:

  1. 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)

screen shot 2018-11-27 at 12 13 53 pm

  1. 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.

@agirault agirault changed the title Issues with keyplane and snapshotting Issues with keyplane, leaks, and snapshotting Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant