现在,我的应用程序由一个UINavigationController组成,然后它(通过一个按钮)传递给一个普通的UIViewController,然后它使用presentModalViewController加载另一个UIViewController (没有导航栏)。
如果我尝试在iOS6.1模拟器中运行该程序,它可以很好地工作。然而,如果我尝试在iOS5.1模拟器中运行它,当我调用presentModalViewController时,我得到一个sigabrt错误。在我引入UINavigationController之前,这段代码就可以工作了,但是我现在不知道是什么导致了这个错误。
可能的相关细节:
UINavigationController和第一个UIViewController都是通过使用故事板来工作的。但是,我使用的第二个UIViewController (我传递给它的那个)是通过.xib文件加载的。
实际传递的代码如下所示。
AllViewController* controller = [[AllViewController alloc] initWithNibName:[NSString stringWithFormat:@"AllViewController"] bundle:nil];
controller.delegate = self;
//And now for the swap
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];控制台对该错误的输出如下:
2013-05-17 13:38:49.934 Practice Solutions[4372:15203] *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'
*** First throw call stack:
(0x1627022 0xf9fcd6 0x15cfa48 0x15cf9b9 0x4234a3 0x42367b 0x423383 0x32316d 0x1c91fc 0x1c9779 0x1c999b 0x1d29bc 0x1cd818 0x3e9565 0x1d0857 0x1d09bc 0x1d09fc 0x4d7e 0x1628e99 0x10514e 0x1050e6 0x1abade 0x1abfa7 0x1ab266 0x12a3c0 0x12a5e6 0x110dc4 0x104634 0x17baef5 0x15fb195 0x155fff2 0x155e8da 0x155dd84 0x155dc9b 0x17b97d8 0x17b988a 0x102626 0x274d 0x2675)
terminate called throwing an exception(lldb) 如果有人能在这方面提供帮助,我们将不胜感激。
发布于 2013-05-18 01:45:50
您在接口生成器中使用约束,而它只适用于iOS 6,所以您需要在IB中将其关闭。
https://stackoverflow.com/questions/16615001
复制相似问题