You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
Describe the bug
When developing Metatext, very frequent layout warnings appear in console.
2022-11-27 11:41:31.469415-0800 Metatext[82387:3629457] [LayoutConstraints] Unable to simultaneously satisfy constraints.
these might have performance consequences.
To Reproduce
Steps to reproduce the behavior:
download Metatext from this repo
open in Xcode.
adjust signing and capabilities so it can be run on device
run on device
observe messages in log
set breakpoint on UIViewAlertForUnsatisfiableConstraints
Expected behavior
normal execution should not encounter layout issues.
Issue 1
the
breakpoint is hit on this call to shareButton.accessibilityLabel, oddly.
// StatusView.swift
if shareButton.isEnabled {
actions.append(UIAccessibilityCustomAction(
name: shareButton.accessibilityLabel ??""){ _ in
viewModel.shareStatus()return true
})}
it's unclear why accessibilityLabel: String would cause a layout, but it does.
suggest: replace this (and all other reads of accessibilityLabel) with a direct reference to the underlying string. This is obvious for reblog and reply, but share label comes from outside
Issue 2
too many constraints cause conflict
this error
2022-11-27 11:41:31.469415-0800 Metatext[82387:3629457] [LayoutConstraints] Unable to simultaneously satisfy constraints.
is caused in this code by temporarily having two constraints that conflict
func hideNewItemsView(){UIView.animate(withDuration:.zeroIfReduceMotion(.defaultAnimationDuration)){self.newItemsView.alpha =0self.newItemsViewHiddenConstraint?.isActive = true // Here
self.newItemsViewVisibleConstraint?.isActive = false // switch these calls
self.view.layoutIfNeeded()} completion:{ _ inself.reloadVisibleItems()}}
resolution: invert the order - deactivate the visible first, then activate the hidden one. This removes the conflict.
AccountHeaderView adds 1 new conflicting constraint each time it is laid out, resulting in 9 or 10 by the time I stopped counting.
overridefunc layoutSubviews(){
super.layoutSubviews()
if let pointSize = followingButton.titleLabel?.font.pointSize {
relationshipButtonsStackView.heightAnchor
.constraint(equalToConstant: pointSize +.defaultSpacing *2).isActive = true
This logic should probably be moved, or replace with something like the following pseudoCode
if let pointSize = followingButton.titleLabel?.font.pointSize {
if let existingConstraint = constraints.first(where:{ $0.identifier =="HA1"}){
constraints.isActive = false
}letnewConstraint=constraint(equalToConstant …)
newConstraint.identifier ="HA1"
newConstraint.isActive = true
Additional context
other log message that are concerning
2022-11-27 11:28:01.013949-0800 Metatext[] [AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:82216 (
2022-11-27 11:28:00.481973-0800 Metatext[] [Application] -[UIApplication _touchesEvent] will no longer work as expected. Please stop using it.
Thread Performance Checker: Thread running at QOS_CLASS_USER_INITIATED waiting on a thread without a QoS class specified. Investigate ways to avoid priority inversions. Set environment variable 'PERFC_LOG_BACKTRACE_TO_STDERR' to 1 to see backtrace
2022-11-27 12:03:24.027885-0800 Metatext[] [TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at
The text was updated successfully, but these errors were encountered:
alexbbrown
changed the title
2 Layout constraint warnings with recommended mitigations
3 Layout constraint warnings with recommended mitigations
Nov 27, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
When developing Metatext, very frequent layout warnings appear in console.
these might have performance consequences.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
normal execution should not encounter layout issues.
Issue 1
the
breakpoint is hit on this call to shareButton.accessibilityLabel, oddly.
it's unclear why accessibilityLabel: String would cause a layout, but it does.
suggest: replace this (and all other reads of accessibilityLabel) with a direct reference to the underlying string. This is obvious for reblog and reply, but share label comes from outside
Issue 2
too many constraints cause conflict
this error
is caused in this code by temporarily having two constraints that conflict
resolution: invert the order - deactivate the visible first, then activate the hidden one. This removes the conflict.
(please complete the following information):
issue 3
AccountHeaderView adds 1 new conflicting constraint each time it is laid out, resulting in 9 or 10 by the time I stopped counting.
This logic should probably be moved, or replace with something like the following pseudoCode
Additional context
other log message that are concerning
The text was updated successfully, but these errors were encountered: