'NSInternalInconsistencyException', reason: 'attempting to add unsupported attribute: (null)'

1.7k Views Asked by At

Im using a (lightly modified)third party package: https://github.com/adad184/MMPopupView

Iv already got a view controller where a alert is presented and works as expected

Iv basically made a very similar new controller and trying to display the same alert, so i have copy pasted. But I'm receiving the error

'NSInternalInconsistencyException', reason: 'attempting to add unsupported attribute: (null)'

The working code:

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)))

Not working:

                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)))

My modified 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];
    }
}

The traceback reveals its the masonry view constraint triggering it:

*** Assertion failure in -[MASViewConstraint setSecondViewAttribute:], /Users/Nic/Sync/iPGP/Pods/Masonry/Masonry/MASViewConstraint.m:130

Im pretty confident it has something to do with my main view (self.view) as when i add a sub view in the editor within the main view, e.g.. self.testview I don't get the error message..

I can't understand why this is happening, i have checked and the reference outlets are set up exactly the same. Everything iv looked at is the same

Im having some other problems when adding more subviews, and considering again the code is the same I'm assuming it must be something wrong with the main self.view?

0

There are 0 best solutions below