我正在使用(轻微修改过的)第三方软件包:https://github.com/adad184/MMPopupView
我已经有了一个视图控制器,其中显示了警报并按预期工作
Iv基本上制作了一个非常相似的新控制器,并试图显示相同的警报,所以我有复制粘贴。但是我收到了错误
'NSInternalInconsistencyException', reason: 'attempting to add unsupported attribute: (null)'
工作代码:
self.alertView = MMAlertView(inputTitle: "Message", detail: "Please enter..", placeholder: "Password", handler: alertCompletion)
self.alertView?.attachedView = self.view
self.alertView?.attachedView.mm_dimBackgroundBlurEnabled = false;
self.alertView?.show(0-CGFloat(self.heightForOrientation(self.interfaceOrientation, withTopBanner: false)))
不工作:
self.dAlertView = MMAlertView(inputTitle: "Message", detail: string, placeholder: "Password", handler: alertCompletion)
self.dAlertView?.attachedView = self.view // this crashes when on self.view??? But it works with the encryption???
self.dAlertView?.attachedView.mm_dimBackgroundBlurEnabled = false;
self.dAlertView?.show(0-CGFloat(self.heightForOrientation(self.interfaceOrientation, withTopBanner: false)))
我修改过的show():
- (void)showWithBlock:(MMPopupCompletionBlock)block
{
if ( block )
{
self.showCompletionBlock = block;
}
if ( !self.attachedView )
{
self.attachedView = [MMPopupWindow sharedWindow].attachView;
}
[self.attachedView mm_showDimBackground];
MMPopupBlock showAnimation = self.showAnimation;
NSAssert(showAnimation, @"show animation must be there");
showAnimation(self);
[self.attachedView.mm_dimBackgroundView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.attachedView.superview.mas_top);
make.left.equalTo(self.attachedView.superview.mas_left);
make.right.equalTo(self.attachedView.superview.mas_right);
make.bottom.equalTo(self.attachedView.superview.mas_bottom).with.offset(self.keyboardHeight);
}];
if ( self.withKeyboard )
{
[self showKeyboard];
}
}
追溯显示触发它的砌体视图约束:
*** Assertion failure in -[MASViewConstraint setSecondViewAttribute:], /Users/Nic/Sync/iPGP/Pods/Masonry/Masonry/MASViewConstraint.m:130
我非常有信心它与我的主视图(self.view)有关,就像我在主视图中的编辑器中添加子视图一样,例如.. self.testview 我没有收到错误消息..
我无法理解为什么会发生这种情况,我已经检查过并且参考插座设置完全相同。静脉注视的一切都是一样的
我在添加更多子视图时遇到了一些其他问题,并且再次考虑代码是一样的我假设主要的self.view一定有问题吗?