该应用程序在Location anchors require being paired.
上崩溃。我想修复它,但无论我用这个视图手动测试应用程序多少次,我都没遇到过崩溃(只登录Crashlytics)。任何人都知道这里可能出现什么问题,在什么情况下可能会发生崩溃?
属性centerYConstraint
是必需的,因为稍后它允许用户向上/向下移动视图。
MyView.m
文件的一部分。设置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;
}
崩溃日志:
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.