3

I have a very basic alert view

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Exit" message:@"Please enter the password." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
alertView.tag = 2;
alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;
[alertView textFieldAtIndex:0].delegate = self;
[alertView show];

If I comment setting the UIAlertViewStyleSecureTextInput it works fine but if I left I get a crash when trying to show the alert view:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The layout constraints still need update after sending -updateConstraints to <_UIKeyboardLayoutAlignmentView: 0x155289c0; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x1558f510>>.
_UIKeyboardLayoutAlignmentView or one of its superclasses may have overridden -updateConstraints without calling super. Or, something may have dirtied layout constraints in the middle of updating them.  Both are programming errors.'

I'm positive that I'm not modifying the constraints of the UIAlertView though I do have a lot of constraints on the rest of the layout.

Why would simply having a text field on a UIAlertView cause the constraint crash?

Rudiger
  • 6,749
  • 13
  • 51
  • 102
  • 1
    There is nothing wrong with the code. I have checked this and it works fine. Definitely app is crashing bacause of layout constraint. Try calling setNeedsUpdateConstraints after alert show. Something like this - [self.view setNeedsUpdateConstraints]; – Uttam Sinha May 19 '15 at 12:00
  • http://stackoverflow.com/questions/29637443/nsinteralinconsistencyexception-uikeyboardlayoutalignmentview refer this answer – ViruMax Jul 23 '15 at 11:29
  • @ViruMax That was actually my solution but I haven't had time to update this question, though I hadn't come across that link. – Rudiger Jul 23 '15 at 11:35

0 Answers0