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
  • 13,766
  • 23
  • 96
  • 185

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
  • 20,880
  • 13
  • 75
  • 99
Fonix
  • 11,049
  • 2
  • 43
  • 69