为什么此代码在iOS 5.1中崩溃而不在iOS 6中崩溃? [英] Why does this code crash in iOS 5.1 but not iOS 6?

查看:42
本文介绍了为什么此代码在iOS 5.1中崩溃而不在iOS 6中崩溃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码是从设置"标签的导航"视图中调用的.它在iOS 5.1的最后一行崩溃,但不是 iOS6.为什么?

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];
    }

它崩溃于:

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

这是崩溃:

*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'

推荐答案

如果在显示的视图中使用自动布局(默认情况下在其上创建了一个新的笔尖),则会崩溃,因为仅在自动布局中引入了自动布局ios 6.

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 5.1中崩溃而不在iOS 6中崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆