Fix hundreds of lines of warnings re layout constraints from DatePicker - datepicker

Using the new (iOS 14) DatePicker in SwiftUI, it works as expected and looks fine in the simulator & on the device, BUT as soon as the calendar pops up, I get a few HUNDRED lines of warning in the output window. Which is a little annoying!
While the logs are posted below, the seemingly relevant content seems to be:
UIDatePicker 0x7fbd66fc49f0 is being laid out below its minimum width of 280. This may not look like expected, especially with larger than normal font sizes.
But, as the code below shows, I'm not constraining anything narrower than 300 points. And, everything shows up fine.
Either of two solutions would work fine from my standpoint:
suppress all warnings, or
add whatever fixes to the code to eliminate the warnings
The code that pops up the Date Picker, which generates all the warnings as soon as the control is tapped:
struct MyCustomDatePicker : View {
var doSomething : (Date) -> ()
#State var title: String
#State var ignoreSelStart : Bool
#State var ignoreSelEnd : Bool
#State var selectedDate : Date
#ObservedObject var limits : DateRangeLimits
var body: some View {
VStack {
DatePicker(
"\(title)", selection: $selectedDate,
in: ((ignoreSelStart ? limits.hardStart : limits.selectedStart)...(ignoreSelEnd ? limits.hardEnd : limits.selectedEnd)), displayedComponents: [.date]
)
.onChange(of: selectedDate, perform: { value in
doSomething(selectedDate)
})
}
.frame(width: 400, height: 100, alignment: .center)
.background(Color.white)
}
}
This struct is called from here:
struct FlexChoice : View {
#ObservedObject var limits = DateRangeLimits()
func setStart(d: Date) {
// stuff
}
func setEnd(d: Date) {
// stuff
}
var body: some View {
VStack(spacing: 0) {
if customDateRangePossible {
HStack {
MyCustomDatePicker(doSomething: self.setStart, title: "Begin ",
ignoreSelStart: true, ignoreSelEnd: false,
selectedDate: limits.selectedStart, limits: limits)
MyCustomDatePicker(doSomething: self.setEnd, title: "Finish ",
ignoreSelStart: false, ignoreSelEnd: true,
selectedDate: limits.selectedEnd, limits: limits)
} // closes HStack
} // closes "if customDateRangePossible..."
} // closes VStack
} // closes body
} // closes struct
The first bit of the warnings:
2021-01-23 10:06:35.707334-0600 MyAppName[28362:46367754] [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.
(
"<_UISystemBaselineConstraint:0x6000011979d0 H:[_UIDatePickerLinkedLabel:0x7fbd66ffda10]-(NSLayoutAnchorConstraintSpace(8))-[UILayoutGuide:0x6000008f4540''] (active)>",
"<_UISystemBaselineConstraint:0x600001196f30 H:[UILayoutGuide:0x6000008f4540'']-(>=NSLayoutAnchorConstraintSpace(8))-[_UIDatePickerTouchOutsetButton:0x7fbd66f8e9d0] (active)>",
"<NSLayoutConstraint:0x600001197070 _UIDatePickerLinkedLabel:0x7fbd66ffda10.leading == UILayoutGuide:0x6000008f41c0'UIViewLayoutMarginsGuide'.leading (active)>",
"<NSLayoutConstraint:0x600001194fa0 H:[_UIDatePickerTouchOutsetButton:0x7fbd66f8e9d0]-(28)-[_UIDatePickerTouchOutsetButton:0x7fbd72922e40] (active)>",
"<NSLayoutConstraint:0x600001197340 _UIDatePickerTouchOutsetButton:0x7fbd72922e40.trailing == UILayoutGuide:0x6000008f41c0'UIViewLayoutMarginsGuide'.trailing (active)>",
"<NSLayoutConstraint:0x6000011975c0 UILayoutGuide:0x6000008f4540''.width == UIImageView:0x7fbd66f8e800.width (active)>",
"<NSLayoutConstraint:0x60000125fca0 _UIDatePickerCalendarContentStackView:0x7fbd66f8ad40.width <= _UIDatePickerCalendarView:0x7fbd66fc49f0.width (active)>",
"<NSLayoutConstraint:0x6000011c2f30 H:|-(0)-[_UIDatePickerCalendarView:0x7fbd66fc49f0] (active, names: '|':UIDatePicker:0x7fbd7298e840 )>",
"<NSLayoutConstraint:0x6000011c0500 _UIDatePickerCalendarView:0x7fbd66fc49f0.trailing == UIDatePicker:0x7fbd7298e840.trailing (active)>",
"<NSLayoutConstraint:0x60000125ee90 H:|-(8)-[UIDatePicker:0x7fbd7298e840] (active, names: '|':UIView:0x7fbd72d46870 )>",
"<NSLayoutConstraint:0x6000012573e0 UIDatePicker:0x7fbd7298e840.trailing == UIView:0x7fbd72d46870.trailing - 8 (active)>",
"<NSLayoutConstraint:0x6000011de120 'UISV-canvas-connection' _UIDatePickerCalendarContentStackView:0x7fbd66f8ad40.leading == _UIDatePickerCalendarHeaderView:0x7fbd66f8aed0.leading (active)>",
"<NSLayoutConstraint:0x6000011df390 'UISV-canvas-connection' H:[_UIDatePickerCalendarHeaderView:0x7fbd66f8aed0]-(0)-| (active, names: '|':_UIDatePickerCalendarContentStackView:0x7fbd66f8ad40 )>",
"<NSLayoutConstraint:0x6000011cfca0 'UIView-Encapsulated-Layout-Width' UIView:0x7fbd72d46870.width == 0 (active)>",
"<NSLayoutConstraint:0x60000119cd20 'UIView-leftMargin-guide-constraint' H:|-(8)-[UILayoutGuide:0x6000008f41c0'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UIDatePickerCalendarHeaderView:0x7fbd66f8aed0 )>",
"<NSLayoutConstraint:0x6000011977a0 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x6000008f41c0'UIViewLayoutMarginsGuide']-(8)-|(LTR) (active, names: '|':_UIDatePickerCalendarHeaderView:0x7fbd66f8aed0 )>"
)
Will attempt to recover by breaking constraint
<_UISystemBaselineConstraint:0x600001196f30 H:[UILayoutGuide:0x6000008f4540'']-(>=NSLayoutAnchorConstraintSpace(8))-[_UIDatePickerTouchOutsetButton:0x7fbd66f8e9d0] (active)>
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.
What follows are many repetitions of basically that same warning (minus the constraint that was just broken on each successive iteration).
At the very end of the hundreds of lines of warning are the following:
2021-01-23 10:06:35.734386-0600 MyAppName[28362:46367754] [DatePicker] UIDatePicker 0x7fbd66fc49f0 is being laid out below its minimum width of 280. This may not look like expected, especially with larger than normal font sizes.
2021-01-23 10:06:35.740477-0600 MyAppName[28362:46367754] [DatePicker] UIDatePicker 0x7fbd66fc49f0 is being laid out below its minimum width of 280. This may not look like expected, especially with larger than normal font sizes.
2021-01-23 10:06:35.752360-0600 MyAppName[28362:46367754] [DatePicker] UIDatePicker 0x7fbd66fc49f0 is being laid out below its minimum width of 280. This may not look like expected, especially with larger than normal font sizes.
Is there a way to make the DatePicker happy & make it so that these warnings don't flood the output window, either by fixing things or suppressing the warnings?

I'm getting the same warnings and I'm doing all my constraints programmatically (below). I tried setting my constraints to lower priority (900), so that they wouldn't conflict with any system constraints that might be there but it didn't make any difference.
"V:[timePeriodControl]-(0#900)-[datePicker]"
"H:[datePicker]-(0#900)-|"
The compact picker displays the date fine at first. It's only when I tap on the compact picker and the _UIDatePickerIOSCompactViewController is created to display the calendar that the warnings occur. All the constraint warnings are on the calendar view, which is created by the SDK, not us.
In this screenshot from the debugger you can even see the compact date picker view is still in its right place and is the right size (blue box on right). I checked it's constraints and they are fine (you can print out a list from the debugger). So it's not the compact picker that's the problem, it's definitely the calendar view controller needs a radar. This is an iOS SDK bug.

If you use GraphicalDatePickerStyle, try:
DatePicker("", ....)
.datePickerStyle(GraphicalDatePickerStyle())
.padding() // this line solves the problem.
I use the CompactDatePickerStyle and the problem unfortunately still exists.

Related

Better way of handling Tap Gesture on Lists

I'm trying to implement a 1 count tap gesture and 2 count tap gesture on rows of a list view.
Currently I'm achieving this by expanding the contents of the rows to fill the entire width and height, by changing the row insets with .listRowInsets(EdgeInsets()) and adding an HStack with a Spacer inside. As seen below:
My ListRow View, which serves to attempt to fill out the the entire rows' width and height. (With a red border for debugging):
struct ListRow<Content: View> : View {
let content: () -> Content
var body: some View {
HStack {
content()
Spacer()
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.contentShape(Rectangle())
.border(Color.red)
}
}
And here's a snippet of one of the two places I'm using a list with my ListRow:
List(selection: $selectedItem) {
Section(header: Text("Favourites")) {
ForEach($sidebarItems, id: \.self) { $item in
ListRow {
FileLabel(URL(string: item.path)!, size: 14, text: item.text)
}.gesture(TapGesture().onEnded {
selectedItem = item
fileState.updatePath(path: item.path)
}).listRowInsets(EdgeInsets())
}
}
}.listStyle(SidebarListStyle())
A few issues happen here, which both feels hacky and incorrect to do.
I have to manually select the row when the content is tapped.
I actually manually have to focus the list, if it's not actually focused when clicking a row, otherwise the selection is a very faint color.
The contents aren't actually expanding to the leading and trailing edges of the row, no matter if I give my EdgeInsets negative values (This just results in the contents getting clipped, rather than expanding to the edge).
Clicking the areas outside of the red border (seen below) results in the row being selected, but the tap action not firing.
Preferably I'd love if there was a way to listen for tap gestures on a list and get the row that was tapped. It would fix having to manually reimplement features that the List already has built-in and lowering the risk of introducing bugs + it just feels like the right way to do it, unfortunately I haven't been able to find other ways of implementing this, other than creating an HStack with a Spacer.
EDIT:
I'm curious as to how NavigationLink works as no matter where you click, or if you navigate using your keyboard, it'll actually trigger the navigation. Makes me think there's some kind of binding or event fired?

SwiftUI on Mac: Help Text Always Visible Even within View with Zero Opacity

I have run into some unexpected behavior while using SwiftUI in a macOS app. I filed a Feedback with Apple in case it's a bug, but it might actually be designed to work this way, so I'm looking for a workaround.
I rely heavily on the use of .opacity() to show and hide different sections of my app with tabs. I don't use if clauses because each time the user changes the tab, you have to wait for the entire view to rebuild and that is pretty slow.
Here's a basic example that demonstrates the problem:
struct ContentView: View {
#State var viewAVisible = false
var body: some View {
VStack{
ZStack{
Text("View A Visible")
.frame(width: 500, height: 500)
.background(Color.blue)
.help("This is View A's help text. It should be invisible when View A is invisible.")
.opacity(viewAVisible ? 1 : 0)
Text("View B Visible")
.frame(width: 500, height: 500)
.background(Color.gray)
.opacity(viewAVisible ? 0 : 1)
}
Button("Toggle"){
viewAVisible.toggle()
}
}.padding()
}
}
The default app state is to hide the "View A" Text() and only show the "View B" Text(). But if you hover over View B, you still see View A's .help text:
In my opinion, if a view has .opacity(0) then its help text shouldn't show up. But regardless, I need to find a way around this.
I thought about doing something like this:
.help(viewAVisible ? "This is View A's help text..." : "")
...but that doesn't scale across dozens of views in my app--particularly among child views that don't know if their parent view is shown or hidden. As I mouse across my app, I see the help text of tons of views all over the place even though they are invisible. 😅
Has anyone run into this or have any suggestions on how to handle it?
Looks like a bug (they do not remove tracking rects), here is a demo of workaround - move help tag into background and remove it manually (tested with macOS 12.0.1)
Text("View A Visible")
.frame(width: 500, height: 500)
.background(Group {
if viewAVisible {
Color.blue.help("This is View A's help text. It should be invisible when View A is invisible.")
} else {
Color.clear
}
})
.opacity(viewAVisible ? 1 : 0)

Is there a way to keep a SwiftUI text label from slightly moving while displaying a timer?

I have a simple HStack containing 2 Text structs displaying a timer. It keeps changing position slightly while the timer value changes. Is there a way to avoid this behavior.
struct DurationLabel: View {
let majorDuration: String // the hours/minutes part "00:00"
let minorDuration: String // the seconds part "00"
var body: some View {
HStack(spacing: 0) {
Text(majorDuration + minorDuration)
.font(.system(size: 90))
Text(minorDuration)
.font(.body)
}
}
}
For displays like this I prefer to use a font with monospaced digits. You can use them in your Text like so:
Text("your Text here").font(Font.largeTitle.monospacedDigit())
I've done this a number of times for audio players, etc... If you want to keep the same font, you can do something like:
ZStack(alignment: .leading) {
Text("00:00").opacity(0.0)
Text("MM:SS") // Put your actual numbers in here with the same formatting.
}
The ZStack will size itself based on the largest subview, and 0 is the widest digit in basically any font.
With .center alignment this will keep surrounding views from shifting around each second. With .leading, you keep the label itself from shifting too much.
This technique works for any type of content that may change size. Just load up a "dummy" view with the largest possible version and hide it. Then keep your real content in the visible view. Then you can avoid hardcoding a frame size, etc...

Why is my SwiftUI List row not always updating internally

I have a list of reminders grouped into sections by completion and date. With data coming from an ObservedObject DataStore called global. I pass a realmBinding to the cell. The cell can update this binding and it will trigger the data store to update.
List {
// Past Due
if self.global.pastDueReminders.count > 0 {
Section(header: SectionHeader {}){
ForEach(self.global.pastDueReminders) { reminder in
NavigationLink(destination: ReminderDetail( reminder: reminder.realmBinding())) {
GeneralReminderCell(reminder: reminder.realmBinding())
}
}
}
}
// Completed
if self.global.completeReminders.count > 0 {
// Same as PastDue but for Completed
}
}
The cell looks something like:
struct GeneralReminderCell: View {
#Binding var reminder:Reminder
var body: some View {
HStack(alignment:.top, spacing: 10) {
Image(systemName: reminder.completed ? "checkmark.circle.fill" : "circle")
.onTapGesture(perform:{ self.reminder.completed = !self.reminder.completed })
VStack(alignment: .leading, spacing: 2) {
Text("Follow up with \(reminder.client.fullName)").fontWeight(.semibold)
if reminder.title.count > 0 {
Text(reminder.title)
}
Text(reminder.date.formatted()).foregroundColor(.gray)
}
}.padding(.vertical, 10)
}
}
When tapping on an image it toggles the reminder completion state and its position changes in the List view. The image that was tapped should changed to a filled in check when completed.
This behaviour almost always happens as expected, but sometimes the checked image will get out of sync with the completed state of reminder. I've look at this for quite some time and have not made much headway. Why is the checked image not always matching the state of the data?
Even though this is a very old question, I may have been working on what appears to be this same problem. In my case, my App is running on macOS. At first, the problem also seemed to be very intermittent and had been difficult to reproduce consistently.
I also have a View with a ForEach supplying rows to a List. My row's View contains an #State for an Optional Image that gets updated several different ways via actions performed by that same row View (e.g. Continuity Camera, file picker or drag & drop). The issue is that sometimes the new Image is shown and sometimes it is not shown. Using Self._printChanges() I am able to see that the #State is changing and the row's body it is being redrawn, however, the rendered View does not change. The only pattern that I am able to observe is that this issue only seems to occur with the last row in the List. Based on the success of my workaround below, it seems to confirm that there is an issue with the way SwiftUI's List reuses table cells.
My solution/workaround is to replace:
List {
ForEach {
}
}
With:
ScrollView {
LazyVStack {
ForEach {
}
}
}

Automatic constraints violations in stack view, Swift 2, iOS 9.3, XCode 7

I couldn't find a similar problem anywhere, so here is my first post: I am working on a swift 2 project for iPhone. I have devised a "settings" screen with embedded stack views:
Layout showing bounds boxes and constraints
So, there is a main "vertical" stack view with two subviews, spaced equally: the top one corresponds to color palette settings, with the following elements:
The window's main label ("Color Scheme")
A slider to change hue (tint), with name label ("Hue")
A switch to toggle color/B&W, with name label ("Color")
A switch to toggle monochrome palette vs "rainbow" palette, with name label ("Rainbow")
An horizontal stack view with 9 subviews, one for each palette color
The bottom view is for weather view settings, and doesn't have any problems.
The main stack view is set up to change from "vertical" to "horizontal" when changing from portrait to landscape orientation:
Landscape orientation layout, showing all bounds boxes and constraints
The storyboard editor shows no constraint error whatsoever in either orientation (all show in blue), but at runtime, when running in the simulator, changing the settings screen orientation to landscape generates multiple "unable to satisfy constraints" errors, although the screen shows and behaves perfectly.
The weird thing, is that the constraint error messages repeat several times, each time trying to recover by breaking constraints within the second stack view! (which are supposed to be handled automatically by the stack view itself). In particular, the system is trying to break multiple "equal bottom" constraints setting the bottoms of different pairs of embedded subviews to equal values. That is, the nine subviews within the second stack view are supposed to have their bottom bounds at the same level (this is imposed by the stack view itself, so I can't modify it in my program). Each time the systems tries this, it fails, so a new error is output to the console, and the system tries to break another "bottom == bottom" constraint within the stack view, with a new failure.
This goes on several times (from 5 to 8 times), until it settles by trying to break the main label ("Color Scheme") vertical size constraint. In view of this final result, I changed the compression priority of the main label vertical size, but I am still getting the errors. Here is a console dump:
2016-04-22 10:06:14.061 Just Now[9468:534833] 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.
(
"<_UILayoutSupportConstraint:0x7fa918c200e0 V:[_UILayoutGuide:0x7fa91f55acf0(44)]>",
"<_UILayoutSupportConstraint:0x7fa91f582a20 V:|-(0)-[_UILayoutGuide:0x7fa91f55acf0] (Names: '|':UIView:0x7fa91f53a530 )>",
"<_UILayoutSupportConstraint:0x7fa91f5c65a0 V:[_UILayoutGuide:0x7fa91f5d2350(0)]>",
"<_UILayoutSupportConstraint:0x7fa918c11a20 _UILayoutGuide:0x7fa91f5d2350.bottom == UIView:0x7fa91f53a530.bottom>",
"<NSLayoutConstraint:0x7fa91f5d7bd0 V:[UISlider:0x7fa91f5d74e0(30)]>",
"<NSLayoutConstraint:0x7fa91f5c5ef0 V:[UILabel:0x7fa91f5c5c90'Color Scheme'(32)]>",
"<NSLayoutConstraint:0x7fa91f5d49d0 V:[UISwitch:0x7fa91f5d4810(31)]>",
"<NSLayoutConstraint:0x7fa91f53e850 V:[UILabel:0x7fa91f511840'Hue'(21)]>",
"<NSLayoutConstraint:0x7fa91f539a00 V:|-(8)-[UILabel:0x7fa91f5c5c90'Color Scheme'] (Names: '|':UIView:0x7fa91f5c5b00 )>",
"<NSLayoutConstraint:0x7fa91f539af0 V:[UILabel:0x7fa91f5c5c90'Color Scheme']-(5)-[UILabel:0x7fa91f511840'Hue']>",
"<NSLayoutConstraint:0x7fa91f539b40 V:[UILabel:0x7fa91f511840'Hue']-(8)-[UISlider:0x7fa91f5d74e0]>",
"<NSLayoutConstraint:0x7fa91f539dc0 V:[UISwitch:0x7fa91f5d4810]-(19)-[UIStackView:0x7fa91f5c6650]>",
"<NSLayoutConstraint:0x7fa91f539e10 V:[UIStackView:0x7fa91f5c6650]-(8)-| (Names: '|':UIView:0x7fa91f5c5b00 )>",
"<NSLayoutConstraint:0x7fa91f539f50 V:[UISlider:0x7fa91f5d74e0]-(37)-[UISwitch:0x7fa91f5d4810]>",
"<NSLayoutConstraint:0x7fa91f582f10 V:[_UILayoutGuide:0x7fa91f55acf0]-(0)-[UIStackView:0x7fa91f53a6a0]>",
"<NSLayoutConstraint:0x7fa91f582f60 V:[UIStackView:0x7fa91f53a6a0]-(0)-[_UILayoutGuide:0x7fa91f5d2350]>",
"<NSLayoutConstraint:0x7fa91f41c650 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c67e0.bottom>",
"<NSLayoutConstraint:0x7fa91f417010 'UISV-alignment' UIView:0x7fa91f5c5850.top == UIView:0x7fa91f5c67e0.top>",
"<NSLayoutConstraint:0x7fa91f434df0 'UISV-canvas-connection' UIStackView:0x7fa91f5c6650.top == UIView:0x7fa91f5c5850.top>",
"<NSLayoutConstraint:0x7fa91f40dad0 'UISV-canvas-connection' V:[UIView:0x7fa91f5c5850]-(0)-| (Names: '|':UIStackView:0x7fa91f5c6650 )>",
"<NSLayoutConstraint:0x7fa91ffc1160 'UISV-canvas-connection' UIStackView:0x7fa91f53a6a0.top == UIView:0x7fa91f5c5b00.top>",
"<NSLayoutConstraint:0x7fa9228831e0 'UISV-canvas-connection' V:[UIView:0x7fa91f53a830]-(0)-| (Names: '|':UIStackView:0x7fa91f53a6a0 )>",
"<NSLayoutConstraint:0x7fa921301830 'UISV-fill-equally' UIView:0x7fa91f53a830.height == UIView:0x7fa91f5c5b00.height>",
"<NSLayoutConstraint:0x7fa91ffc15b0 'UISV-spacing' V:[UIView:0x7fa91f5c5b00]-(0)-[UIView:0x7fa91f53a830]>",
"<NSLayoutConstraint:0x7fa91ffb8540 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fa91f53a530(414)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fa91f41c650 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c67e0.bottom>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-04-22 10:06:14.063 Just Now[9468:534833] 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.
(
"<_UILayoutSupportConstraint:0x7fa918c200e0 V:[_UILayoutGuide:0x7fa91f55acf0(44)]>",
"<_UILayoutSupportConstraint:0x7fa91f582a20 V:|-(0)-[_UILayoutGuide:0x7fa91f55acf0] (Names: '|':UIView:0x7fa91f53a530 )>",
"<_UILayoutSupportConstraint:0x7fa91f5c65a0 V:[_UILayoutGuide:0x7fa91f5d2350(0)]>",
"<_UILayoutSupportConstraint:0x7fa918c11a20 _UILayoutGuide:0x7fa91f5d2350.bottom == UIView:0x7fa91f53a530.bottom>",
"<NSLayoutConstraint:0x7fa91f5d7bd0 V:[UISlider:0x7fa91f5d74e0(30)]>",
"<NSLayoutConstraint:0x7fa91f5c5ef0 V:[UILabel:0x7fa91f5c5c90'Color Scheme'(32)]>",
"<NSLayoutConstraint:0x7fa91f5d49d0 V:[UISwitch:0x7fa91f5d4810(31)]>",
"<NSLayoutConstraint:0x7fa91f53e850 V:[UILabel:0x7fa91f511840'Hue'(21)]>",
"<NSLayoutConstraint:0x7fa91f539a00 V:|-(8)-[UILabel:0x7fa91f5c5c90'Color Scheme'] (Names: '|':UIView:0x7fa91f5c5b00 )>",
"<NSLayoutConstraint:0x7fa91f539af0 V:[UILabel:0x7fa91f5c5c90'Color Scheme']-(5)-[UILabel:0x7fa91f511840'Hue']>",
"<NSLayoutConstraint:0x7fa91f539b40 V:[UILabel:0x7fa91f511840'Hue']-(8)-[UISlider:0x7fa91f5d74e0]>",
"<NSLayoutConstraint:0x7fa91f539dc0 V:[UISwitch:0x7fa91f5d4810]-(19)-[UIStackView:0x7fa91f5c6650]>",
"<NSLayoutConstraint:0x7fa91f539e10 V:[UIStackView:0x7fa91f5c6650]-(8)-| (Names: '|':UIView:0x7fa91f5c5b00 )>",
"<NSLayoutConstraint:0x7fa91f539f50 V:[UISlider:0x7fa91f5d74e0]-(37)-[UISwitch:0x7fa91f5d4810]>",
"<NSLayoutConstraint:0x7fa91f582f10 V:[_UILayoutGuide:0x7fa91f55acf0]-(0)-[UIStackView:0x7fa91f53a6a0]>",
"<NSLayoutConstraint:0x7fa91f582f60 V:[UIStackView:0x7fa91f53a6a0]-(0)-[_UILayoutGuide:0x7fa91f5d2350]>",
"<NSLayoutConstraint:0x7fa921340700 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c6970.bottom>",
"<NSLayoutConstraint:0x7fa91f417120 'UISV-alignment' UIView:0x7fa91f5c5850.top == UIView:0x7fa91f5c6970.top>",
"<NSLayoutConstraint:0x7fa91f434df0 'UISV-canvas-connection' UIStackView:0x7fa91f5c6650.top == UIView:0x7fa91f5c5850.top>",
"<NSLayoutConstraint:0x7fa91f40dad0 'UISV-canvas-connection' V:[UIView:0x7fa91f5c5850]-(0)-| (Names: '|':UIStackView:0x7fa91f5c6650 )>",
"<NSLayoutConstraint:0x7fa91ffc1160 'UISV-canvas-connection' UIStackView:0x7fa91f53a6a0.top == UIView:0x7fa91f5c5b00.top>",
"<NSLayoutConstraint:0x7fa9228831e0 'UISV-canvas-connection' V:[UIView:0x7fa91f53a830]-(0)-| (Names: '|':UIStackView:0x7fa91f53a6a0 )>",
"<NSLayoutConstraint:0x7fa921301830 'UISV-fill-equally' UIView:0x7fa91f53a830.height == UIView:0x7fa91f5c5b00.height>",
"<NSLayoutConstraint:0x7fa91ffc15b0 'UISV-spacing' V:[UIView:0x7fa91f5c5b00]-(0)-[UIView:0x7fa91f53a830]>",
"<NSLayoutConstraint:0x7fa91ffb8540 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fa91f53a530(414)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fa921340700 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c6970.bottom>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-04-22 10:06:14.064 Just Now[9468:534833] 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.
(
"<_UILayoutSupportConstraint:0x7fa918c200e0 V:[_UILayoutGuide:0x7fa91f55acf0(44)]>",
"<_UILayoutSupportConstraint:0x7fa91f582a20 V:|-(0)-[_UILayoutGuide:0x7fa91f55acf0] (Names: '|':UIView:0x7fa91f53a530 )>",
"<_UILayoutSupportConstraint:0x7fa91f5c65a0 V:[_UILayoutGuide:0x7fa91f5d2350(0)]>",
"<_UILayoutSupportConstraint:0x7fa918c11a20 _UILayoutGuide:0x7fa91f5d2350.bottom == UIView:0x7fa91f53a530.bottom>",
"<NSLayoutConstraint:0x7fa91f5d7bd0 V:[UISlider:0x7fa91f5d74e0(30)]>",
"<NSLayoutConstraint:0x7fa91f5c5ef0 V:[UILabel:0x7fa91f5c5c90'Color Scheme'(32)]>",
"<NSLayoutConstraint:0x7fa91f5d49d0 V:[UISwitch:0x7fa91f5d4810(31)]>",
"<NSLayoutConstraint:0x7fa91f53e850 V:[UILabel:0x7fa91f511840'Hue'(21)]>",
"<NSLayoutConstraint:0x7fa91f539a00 V:|-(8)-[UILabel:0x7fa91f5c5c90'Color Scheme'] (Names: '|':UIView:0x7fa91f5c5b00 )>",
"<NSLayoutConstraint:0x7fa91f539af0 V:[UILabel:0x7fa91f5c5c90'Color Scheme']-(5)-[UILabel:0x7fa91f511840'Hue']>",
"<NSLayoutConstraint:0x7fa91f539b40 V:[UILabel:0x7fa91f511840'Hue']-(8)-[UISlider:0x7fa91f5d74e0]>",
"<NSLayoutConstraint:0x7fa91f539dc0 V:[UISwitch:0x7fa91f5d4810]-(19)-[UIStackView:0x7fa91f5c6650]>",
"<NSLayoutConstraint:0x7fa91f539e10 V:[UIStackView:0x7fa91f5c6650]-(8)-| (Names: '|':UIView:0x7fa91f5c5b00 )>",
"<NSLayoutConstraint:0x7fa91f539f50 V:[UISlider:0x7fa91f5d74e0]-(37)-[UISwitch:0x7fa91f5d4810]>",
"<NSLayoutConstraint:0x7fa91f582f10 V:[_UILayoutGuide:0x7fa91f55acf0]-(0)-[UIStackView:0x7fa91f53a6a0]>",
"<NSLayoutConstraint:0x7fa91f582f60 V:[UIStackView:0x7fa91f53a6a0]-(0)-[_UILayoutGuide:0x7fa91f5d2350]>",
"<NSLayoutConstraint:0x7fa921340870 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c6b00.bottom>",
"<NSLayoutConstraint:0x7fa91f4171f0 'UISV-alignment' UIView:0x7fa91f5c5850.top == UIView:0x7fa91f5c6b00.top>",
"<NSLayoutConstraint:0x7fa91f434df0 'UISV-canvas-connection' UIStackView:0x7fa91f5c6650.top == UIView:0x7fa91f5c5850.top>",
"<NSLayoutConstraint:0x7fa91f40dad0 'UISV-canvas-connection' V:[UIView:0x7fa91f5c5850]-(0)-| (Names: '|':UIStackView:0x7fa91f5c6650 )>",
"<NSLayoutConstraint:0x7fa91ffc1160 'UISV-canvas-connection' UIStackView:0x7fa91f53a6a0.top == UIView:0x7fa91f5c5b00.top>",
"<NSLayoutConstraint:0x7fa9228831e0 'UISV-canvas-connection' V:[UIView:0x7fa91f53a830]-(0)-| (Names: '|':UIStackView:0x7fa91f53a6a0 )>",
"<NSLayoutConstraint:0x7fa921301830 'UISV-fill-equally' UIView:0x7fa91f53a830.height == UIView:0x7fa91f5c5b00.height>",
"<NSLayoutConstraint:0x7fa91ffc15b0 'UISV-spacing' V:[UIView:0x7fa91f5c5b00]-(0)-[UIView:0x7fa91f53a830]>",
"<NSLayoutConstraint:0x7fa91ffb8540 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fa91f53a530(414)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fa921340870 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c6b00.bottom>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-04-22 10:06:14.065 Just Now[9468:534833] 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.
(
"<_UILayoutSupportConstraint:0x7fa918c200e0 V:[_UILayoutGuide:0x7fa91f55acf0(44)]>",
"<_UILayoutSupportConstraint:0x7fa91f582a20 V:|-(0)-[_UILayoutGuide:0x7fa91f55acf0] (Names: '|':UIView:0x7fa91f53a530 )>",
"<_UILayoutSupportConstraint:0x7fa91f5c65a0 V:[_UILayoutGuide:0x7fa91f5d2350(0)]>",
"<_UILayoutSupportConstraint:0x7fa918c11a20 _UILayoutGuide:0x7fa91f5d2350.bottom == UIView:0x7fa91f53a530.bottom>",
"<NSLayoutConstraint:0x7fa91f5d7bd0 V:[UISlider:0x7fa91f5d74e0(30)]>",
"<NSLayoutConstraint:0x7fa91f5c5ef0 V:[UILabel:0x7fa91f5c5c90'Color Scheme'(32)]>",
"<NSLayoutConstraint:0x7fa91f5d49d0 V:[UISwitch:0x7fa91f5d4810(31)]>",
"<NSLayoutConstraint:0x7fa91f53e850 V:[UILabel:0x7fa91f511840'Hue'(21)]>",
"<NSLayoutConstraint:0x7fa91f539a00 V:|-(8)-[UILabel:0x7fa91f5c5c90'Color Scheme'] (Names: '|':UIView:0x7fa91f5c5b00 )>",
"<NSLayoutConstraint:0x7fa91f539af0 V:[UILabel:0x7fa91f5c5c90'Color Scheme']-(5)-[UILabel:0x7fa91f511840'Hue']>",
"<NSLayoutConstraint:0x7fa91f539b40 V:[UILabel:0x7fa91f511840'Hue']-(8)-[UISlider:0x7fa91f5d74e0]>",
"<NSLayoutConstraint:0x7fa91f539dc0 V:[UISwitch:0x7fa91f5d4810]-(19)-[UIStackView:0x7fa91f5c6650]>",
"<NSLayoutConstraint:0x7fa91f539e10 V:[UIStackView:0x7fa91f5c6650]-(8)-| (Names: '|':UIView:0x7fa91f5c5b00 )>",
"<NSLayoutConstraint:0x7fa91f539f50 V:[UISlider:0x7fa91f5d74e0]-(37)-[UISwitch:0x7fa91f5d4810]>",
"<NSLayoutConstraint:0x7fa91f582f10 V:[_UILayoutGuide:0x7fa91f55acf0]-(0)-[UIStackView:0x7fa91f53a6a0]>",
"<NSLayoutConstraint:0x7fa91f582f60 V:[UIStackView:0x7fa91f53a6a0]-(0)-[_UILayoutGuide:0x7fa91f5d2350]>",
"<NSLayoutConstraint:0x7fa91ffc1160 'UISV-canvas-connection' UIStackView:0x7fa91f53a6a0.top == UIView:0x7fa91f5c5b00.top>",
"<NSLayoutConstraint:0x7fa9228831e0 'UISV-canvas-connection' V:[UIView:0x7fa91f53a830]-(0)-| (Names: '|':UIStackView:0x7fa91f53a6a0 )>",
"<NSLayoutConstraint:0x7fa921301830 'UISV-fill-equally' UIView:0x7fa91f53a830.height == UIView:0x7fa91f5c5b00.height>",
"<NSLayoutConstraint:0x7fa91ffc15b0 'UISV-spacing' V:[UIView:0x7fa91f5c5b00]-(0)-[UIView:0x7fa91f53a830]>",
"<NSLayoutConstraint:0x7fa91ffb8540 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fa91f53a530(414)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fa91f5c5ef0 V:[UILabel:0x7fa91f5c5c90'Color Scheme'(32)]>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
I have tried moving things around, but I get no errors in the storyboard editor and the runtime errors continue when rotating the screen. The fact that it's trying to break automatic constraints within a stack view makes me think this may be a bug. Regardless of the errors, the program works and looks as it is supposed to, so I am at a loss.
Any help will be appreciated. Thanks in advance!
Ok. I guess everyone knew this, and that's why I didn't get any answers... But this error went away and Xcode is no longer complaining. I will post a follow up in case it returns.