简体   繁体   English

为什么此代码在iOS 5.1中崩溃而不在iOS 6中崩溃?

[英]Why does this code crash in iOS 5.1 but not iOS 6?

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? 它在iOS 5.1的最后一行崩溃,但在iOS 6中没有崩溃。为什么?

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'

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. 如果在显示的视图中使用自动布局(默认情况下在其上创建了一个新的笔尖),则会崩溃,因为仅在ios 6中引入了自动布局。 这是如何禁用它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM