我有一个常规视图控制器,它尝试通过presentViewController或通过使用 UINavigationController 推送控制器来呈现控制器。
当我调用dismissViewControllerAnimated:方法或通过UINavigationController推送时单击返回按钮,应用程序将崩溃并出现以下错误:
012-12-01 13:09:15.789 stats[12370:c07] *** Assertion failure in -[NSLayoutConstraint constant], /SourceCache/Foundation_Sim/Foundation-992/Layout.subproj/NSLayoutConstraint.m:560
2012-12-01 13:09:15.790 stats[12370:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '(null)'
*** First throw call stack:
(0x4ac012 0x1974e7e 0x4abe78 0x140af35 0x15253a2 0x1527cda 0x15274f1 0xdf4bbe 0xdf4da7 0x908be4 0x90905d 0x90905d 0x90905d 0x90905d 0x90905d 0x90905d 0x90905d 0x90905d 0x90905d 0x9045e6 0x90aaf4 0x902eed 0x97cad6 0xba9f44 0xba94eb 0x9a7a11 0x9a6ecd 0x9a6ecd 0x9a7bdb 0xa72739d 0x2e7b0 0xd71b5 0xd6f38 0xd8a19 0x4a01bd 0x4a00d6 0x4a024a 0xe27d69 0xe2913e 0x49bcf9 0x49b94e 0x4a01bd 0x4a00d6 0x4a024a 0xe27d69 0xe279da 0x49bcf9 0x49b94e 0x4a01bd 0x4a00d6 0x4a024a 0xe27d69 0xddb0a7 0x49bcf9 0x49b94e 0x4a01bd 0x4a00d6 0x4a024a 0xe27d69 0xe010cf 0x514753f 0x5159014 0x51497d5 0x452af5 0x451f44 0x451e1b 0x240c7e3 0x240c668 0x8bc65c 0x1e34d 0x2215)
libc++abi.dylib: terminate called throwing an exception
这发生在模拟器和设备上。
这是我展示控制器的方式:
UINavigationController
ChartViewController *chartViewer = [[ChartViewController alloc] initWithNibName:@"ChartViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:chartViewer animated:YES];
当前视图控制器:
ChartViewController *chartViewer = [[ChartViewController alloc] initWithNibName:@"ChartViewController" bundle:[NSBundle mainBundle]];
[self presentViewController:chartViewer animated:YES completion:nil];
提前感谢您的帮助!