从NavigationBarItem看到UINavigationViewController

时间:2013-05-13 19:07:26

标签: ios uiviewcontroller uinavigationcontroller uitableview

我有一个教程,在教程结束时我想从UIViewController推送到UINavigationViewController。我需要UINavigationViewController,因为我正在使用ECSlidingViewController。由这个UINavigationViewController管理的视图是一个UITableViewController。好吧到目前为止一切都很容易理解吗?没问题。但现在它变得奇怪了。 现在我使用这段代码(IBAction):

HomeNavViewController *home = [[HomeNavViewController alloc] init];
[self presentModalViewControllerhome animated:YES];

我得到的一切都是来自调试器的app终止。 有没有人经历过这个?

提前感谢您的任何帮助:)

这是错误消息(抱歉,我忘了先把它发布:) :):

2013-05-14 16:43:07.313 187ers[1124:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x2c3e012 0x210be7e 0x2bf1b6a 0x2bf1a20 0x2aca3f 0xeac4 0x340103 0x34042b 0x34df80 0x54a223 0x346ee3 0x347167 0x3471a7 0xe4cc 0x211f705 0x2602c0 0x49ca64 0x211f705 0x2602c0 0x260258 0x321021 0x32157f 0x3206e8 0x28fcef 0x28ff02 0x26dd4a 0x25f698 0x2b99df9 0x2b99ad0 0x2bb3bf5 0x2bb3962 0x2be4bb6 0x2be3f44 0x2be3e1b 0x2b987e3 0x2b98668 0x25cffc 0x2e4d 0x2d75)
libc++abi.dylib: terminate called throwing an exception
(lldb) 

1 个答案:

答案 0 :(得分:0)

您的错误是由NSMutableArray上的非法操作引起的(您尝试在NSMutableArray中插入nil对象)。检查代码HomeNavViewController`viewDidLoad / viewWillAppear / viewDidAppear(如果实现它们)并确保不要尝试将nil对象插入数组

此外,如果您在[self presentModalViewControllerhome animated:YES];之后执行代码检查同一问题,请将nil对象插入NSMutableArray。

相关问题