0

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

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

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

在此先感谢您的帮助:)

这是错误消息(对不起,我忘了把它放在首位:)):

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) 
4

1 回答 1

0

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

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

于 2013-05-14T14:51:03.193 回答