BLACK FRIDAY SALE: Save 50% on all my Swift books and bundles! >>

Day 17: Constraints error when adding toolbar "Done" button

Forums > 100 Days of SwiftUI

Using XCode 14.3 with an iPhone 14 Pro simulator I'm getting a constraints error when putting focus into the TextField after adding the "Done" button to the keyboard. This causes the decimal keypad not to show up. Any idea how to do this properly on iOS 16?

2023-04-08 21:53:56.778052-0500 WeSplit[24267:1959792] Can't find keyplane that supports type 8 for keyboard iPhone-PortraitChoco-DecimalPad; using 27344_PortraitChoco_iPhone-Simple-Pad_Default 2023-04-08 21:53:56.877824-0500 WeSplit[24267:1959792] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ( "<NSAutoresizingMaskLayoutConstraint:0x600002c912c0 h=--& v=--& _UIToolbarContentView:0x7fafc2f25990.width == 0 (active)>", "<NSLayoutConstraint:0x600002c86da0 H:|-(0)-[_UIButtonBarStackView:0x7fafc2f2ae30] (active, names: '|':_UIToolbarContentView:0x7fafc2f25990 )>", "<NSLayoutConstraint:0x600002c86df0 H:[_UIButtonBarStackView:0x7fafc2f2ae30]-(16)-| (active, names: '|':_UIToolbarContentView:0x7fafc2f25990 )>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x600002c86df0 H:[_UIButtonBarStackView:0x7fafc2f2ae30]-(16)-| (active, names: '|':_UIToolbarContentView:0x7fafc2f25990 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

   

Check out this On Log Noise

   

Thanks, the constraints error prevents the decimal pad from showing up, I only see the "Done" toolbar item come up in the screen. It goes away once I remove the toolbar item code.

   

Hacking with Swift is sponsored by Guardsquare

SPONSORED AppSweep by Guardsquare helps developers automate the mobile app security testing process with fast, free scans. By using AppSweep’s actionable recommendations, developers can improve the security posture of their apps in accordance with security standards like OWASP.

Learn more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.