1

This code is called from inside my Navigation views inside my Settings tab. It crashes on the last line in iOS 5.1 but NOT iOS 6. Why?

else if (indexPath.section == 0 && [[settingsArray objectAtIndex:indexPath.row] isEqualToString:@"Unlock Premium Features"])
    {
        InAppViewController *inappController = [[InAppViewController alloc] initWithNibName:@"InAppViewController" bundle:nil];
        inappController.titleString = @"Upgrade to Pro.";
        EditNavController *navController = [[EditNavController alloc] initWithRootViewController:inappController];
        [self.navigationController presentModalViewController:navController animated:NO];
    }

It crashes on:

[self.navigationController presentModalViewController:navController animated:NO];

Here is the crash:

*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'
Ethan Allen
  • 14,425
  • 24
  • 101
  • 194

1 Answers1

13

if you are using autolayout (if you created a new nib its on by default) in the view being presented, it will crash because auto layouts were only introduced in ios 6. this is how to disable it
(source: raywenderlich.com)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Fonix
  • 11,447
  • 3
  • 45
  • 74