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' 
5
  • 1
    Any particular crash message/stack trace/anything? Commented May 13, 2013 at 19:19
  • 1
    Does it crash on presentModalViewController line? Commented May 13, 2013 at 19:21
  • 1
    Are you sure it's not the other way around? 'presentModalViewController' is deprecated in iOS 6. It can be replaced by presentViewController:animated:completion. (stackoverflow.com/questions/12507455/…) Commented May 13, 2013 at 19:25
  • @leanne, 'deprecated' doesn't mean 'broken' - it means 'we're gonna break it in the next release' ;-j Commented May 13, 2013 at 21:26
  • Yeah, sorry - that was a 'duh' moment... Commented May 15, 2013 at 15:44

1 Answer 1

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)

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for showing how to disable it. It was one stupid button on my view that had the checkmark and it was crashing my whole setup. THANKS!
Still have to wait 2 minutes it says. Don't worry, I will. :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.