In the simulator, when switching between three fields, an error appears in the console. This error appears if you use the SecureField.
import SwiftUI
struct RootView: View {
@State var email: String = ""
@State var name: String = ""
@State var password: String = ""
var body: some View {
VStack {
TextField("Email", text: $email)
TextField("Name", text: $name)
SecureField("Password", text: $password)
}
}
}
2023-02-22 19:04:50.488739+0800 newapp[1610:726583] [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.
(
"<NSLayoutConstraint:0x2803a9cc0 'accessoryView.bottom' _UIRemoteKeyboardPlaceholderView:0x102a2d580.bottom == _UIKBCompatInputView:0x102b19000.top (active)>",
"<NSLayoutConstraint:0x2803dbd90 'assistantHeight' SystemInputAssistantView.height == 45 (active, names: SystemInputAssistantView:0x102b0ccd0 )>",
"<NSLayoutConstraint:0x2803dd130 'assistantView.bottom' SystemInputAssistantView.bottom == _UIKBCompatInputView:0x102b19000.top (active, names: SystemInputAssistantView:0x102b0ccd0 )>",
"<NSLayoutConstraint:0x2803dd0e0 'assistantView.top' V:[_UIRemoteKeyboardPlaceholderView:0x102a2d580]-(0)-[SystemInputAssistantView] (active, names: SystemInputAssistantView:0x102b0ccd0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x2803dd0e0 'assistantView.top' V:[_UIRemoteKeyboardPlaceholderView:0x102a2d580]-(0)-[SystemInputAssistantView] (active, names: SystemInputAssistantView:0x102b0ccd0 )>
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.
If you remove SecureField
, this error disappears.