UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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.

2      

Check out this On Log Noise

2      

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.

2      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.