Xcode 10: Auto Layout error message could be improved by reordering words

Originator:igeek1
Number:rdar://41048249 Date Originated:12-Jun-2018 12:17 PM
Status:Closed Resolved:Feb 26, 2019
Product:iOS + SDK Product Version:Xcode 10.0 (10L176w) on macOS 10.13.5 (17F77)
Classification:UI/Usability Reproducible:Always
 
Summary:
When you try to lower the priority on an active, required constraint, the error message you get is confusing, especially to non-native English speakers.

Steps to Reproduce:
1. Attempt lower the priority on an active, required constraint, for example, like this:

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        let view = UIView()
        self.view.addSubview(view)
        let constraint = view.widthAnchor.constraint(equalTo: view.heightAnchor)
        constraint.isActive = true
        constraint.priority = .defaultLow
    }

}



Expected Results:
The message is clear and unambiguous.

Actual Results:
The message is:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Mutating a priority from required to not on an installed constraint (or vice-versa) is not supported.  You passed priority 250 and the existing priority was 1000.'


Version:
Xcode 10.0 (10L176w) on macOS 10.13.5 (17F77)

Notes:
The problem is dues to the placement of the “(or vice-versa).” It should be modifying the “from required to not,” but since it comes after “on an installed constraint,” it’s hard to tell whether it perhaps is referred to vice-versa-ing the installed constraint. I think a clearer message would be something like this:

'Mutating a priority from required to not (or vice-versa) on an installed constraint is not supported. You passed priority 250 and the existing priority was 1000.'

Note: this is not a regression. This is how the message has been as far back as I can remember. It was just brought up because a non-native English speaker in a Slack group asked for help in deciphering the message.

Comments

Message from Apple, Feb 26, 2019

This error no longer exists because you can change between required and non-required priorities now.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!