我使用(轻微修改)第三方包: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)))
我修改后的显示():
- (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 我没有收到错误消息..
我不明白为什么会发生这种情况,我已经检查过并且参考网点的设置完全相同。iv 看到的一切都是一样的
我在添加更多子视图时遇到了一些其他问题,并且再次考虑代码是相同的我假设它一定是主 self.view 有问题?