本文介绍了presentViewController:iOS上的崩溃< 6(AutoLayout)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我得到的奇怪的崩溃。当我按一个按钮到某个ViewController时,崩溃发生。它崩溃的行是:

This is a weird crash I am getting. The crash happens when I press a button that goes to a certain ViewController. The line which it crashes on is:

DestinationInformationViewController *info = [[DestinationInformationViewController alloc] init];
[info setModalTransitionStyle: UIModalTransitionStyleCrossDissolve];
[self presentViewController:info animated:YES completion: nil]; // CRASHES HERE
[info release];

崩溃跟踪是:

code> ***由于未捕获异常NSInvalidUnarchiveOperationException终止应用程序,原因:无法实例化名为NSLayoutConstraint的类
***第一次调用堆栈:
(0x3758288f 0x35287259 0x37582789 0x375827ab 0x3153d54d 0x3153d6bb 0x3153d423 0x314ce001 0x3143c3c7 0x31319c59 0x3128fc17 0x3129a267 0x3129a1d5 0x3133959b 0x31338367 0x84091 0x374dc3fd 0x31271e07 0x31271dc3 0x31271da1 0x31271b11 0x31272449 0x3127092b 0x31270319 0x31256695 0x31255f3b 0x33c9822b 0x37556523 0x375564c5 0x37555313 0x374d84a5 0x374d836d 0x33c97439 0x31284cd5 0x82bb3 0x71200)
终止叫做抛出异常(GDB)无法实例化类名为NSLayoutConstraint

*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'*** First throw call stack:(0x3758288f 0x35287259 0x37582789 0x375827ab 0x3153d54d 0x3153d6bb 0x3153d423 0x314ce001 0x3143c3c7 0x31319c59 0x3128fc17 0x3129a267 0x3129a1d5 0x3133959b 0x31338367 0x84091 0x374dc3fd 0x31271e07 0x31271dc3 0x31271da1 0x31271b11 0x31272449 0x3127092b 0x31270319 0x31256695 0x31255f3b 0x33c9822b 0x37556523 0x375564c5 0x37555313 0x374d84a5 0x374d836d 0x33c97439 0x31284cd5 0x82bb3 0x71200)terminate called throwing an exception(gdb) Could not instantiate class named NSLayoutConstraint

注意:这在我的iPhone 4 iOS 5.1上崩溃,但不在我的iPhone 4S iOS 6 Beta 2上

NOTE: This crashes on my iPhone 4 iOS 5.1 but not on my iPhone 4S iOS 6 Beta 2

推荐答案

我相信这是Xcode的新界面生成器的一个问题。你碰巧使用Xcode 4.5的界面生成器构建你的。我刚刚遇到了同样的问题,我认为这是问题。

I believe this is an issue with Xcode's new interface builder. Did you happen to build your .xib using Xcode 4.5's interface builder? I've run into this same problem just now, and I think that's the problem. My app runs on iOS 6, but not anything older.

您需要确保关闭使用自动布局

可以通过以下方式完成:

That can be done by:

    $

这篇关于presentViewController:iOS上的崩溃< 6(AutoLayout)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 20:05