mapbox / mapbox/mapbox-navigation-ios

Fix layout constraints warnings.

Open
#2,638 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug UI
Dominant language
Swift
Stars
918
Forks
326
Avg merge
1h 16m
Merged PRs (30d)
3

Description

Multiple broken layout constraints warnings are emitted during device rotation, when presenting NavigationViewController etc.

For example:

2020-09-16 15:42:16.866985-0700 Example[33378:535029] [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:0x60000025bd40 H:|-(8)-[UIImageView:0x7f92dc821120]   (active, names: '|':MapboxNavigation.NavigationMapView:0x7f92da68d000 )>",
    "<NSLayoutConstraint:0x6000002597c0 H:|-(0)-[MapboxNavigation.NavigationMapView:0x7f92da68d000]   (active, names: '|':MapboxNavigation.NavigationView:0x7f92dc81c130 )>",
    "<NSLayoutConstraint:0x600000259cc0 UIImageView:0x7f92dc821120.leading == MapboxNavigation.NavigationView:0x7f92dc81c130.leading + 10   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x60000025bd40 H:|-(8)-[UIImageView:0x7f92dc821120]   (active, names: '|':MapboxNavigation.NavigationMapView:0x7f92da68d000 )>

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.

In scope of this ticket such broken constrains should be detected, UI components constrained correctly and warnings fixed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the warnings during device rotation while presenting NavigationViewController and inspect the listed active constraints, especially those involving NavigationMapView and UIImageView. Trace each constraint to the UI component that creates it, then verify that rotation and presentation complete without broken-constraint warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.