【原】push过快的错误 (Pushing the same view controller instance more than once is not supported)

 

今天在点击按钮push viewController 时,控制台报错:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing the same view controller instance more than once is not supported

 

网上查了以下原因, 是说过快点击可能会产生多次push的情况,在MVC里是不支持这种事件的,所以,保险起见,在可能出现这种情况的push事件里,加以判断即可。

if(![self.navigationController.topViewController isKindOfClass:[currentCLASS class]]) {

参考:http://stackoverflow.com/questions/7083124/pushing-the-same-view-controller-instance-more-than-once-is-not-supported-exce
posted on 2015-06-12 10:11  MichaelMao  阅读(1635)  评论(0编辑  收藏  举报