本文介绍了“不支持多次推送相同的视图控制器实例”例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码检索一些邮件并将它们放入我的收件箱。
I am using the following code to retrieve some messages and putting them into my inbox.
MyInboxVC *inboxVC=[MyInboxVC get ];
//upload all the pending messages
UINavigationController *devNavController=[[MyappMgr get]getDeveloperNavigationController ];
[devNavController pushViewController:inboxVC animated:YES];
[devNavController setNavigationBarHidden:NO];
我得到例外
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing the same view controller instance more than once is not supported (<MyInboxVC: 0x1452a0>)'
这是什么意思?我做错了什么?
What does it mean? What am I doing wrong?
推荐答案
我相信当你做一些非常快的动作时,这也会发生。我用这样的东西构建:
I believe when you do some actions really fast this can happens too. I build something in like this:
if(![self.navigationController.topViewController isKindOfClass:[YOURCLASS class]]) {
编辑//
这种情况经常发生在具有慢动画的旧设备上,例如iphone 3或3gs
this happens more often on old devices with slow animations, like the iphone 3 or 3gs
这篇关于“不支持多次推送相同的视图控制器实例”例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!