Autostart Failure: Location bindings require pairing

The application is broken into Location anchors require being paired.. I would like to fix this, however, no matter how many times I manually tested the application with this view, I never encountered a crash (I received only Crashlytics logs). Does anyone know what could be wrong here, under what circumstances could a crash happen?

A property is required centerYConstraintbecause later it allows the user to move the view up / down.

Part of the file MyView.m. Failure occurs during installation self.centerYConstraint.

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    self.centerYConstraint = [self.view.centerYAnchor constraintEqualToAnchor:self.parentViewController.view.centerYAnchor 
                                                      constant:self.view.center.y - self.parentViewController.view.center.y];
    self.centerYConstraint.active = YES;
}

Crash Log:

Fatal Exception: NSInvalidArgumentException
NSLayoutConstraint for <NSLayoutYAxisAnchor:0x16764ae0 "MyView:0x18e6b900.centerY">: 
A constraint cannot be made from <NSLayoutYAxisAnchor:0x16764ae0 "MyView:0x18e6b900.centerY"> to a constant. 
Location anchors require being paired.
+4
source share

Source: https://habr.com/ru/post/1669363/


All Articles