iOS:在viewDidLoad非平衡调用上循环

我有两个视图控制器。 ViewControllerNext

ViewContoller.m

 - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. bool static check = FALSE; if(!check){ check = true; [self changeView]; } } -(void)changeView{ dispatch_async(dispatch_get_main_queue(), ^{ UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; Next *viewController = (Next *)[storyboard instantiateViewControllerWithIdentifier:@"next"]; [self presentViewController:viewController animated:YES completion:nil]; }); } 

Next.m只不过是一个视图的xcode样板代码。

当我如上执行此操作时,我收到此输出:

 2014-11-27 13:20:21.005 changeView[1804:72014] Unbalanced calls to begin/end appearance transitions for <ViewController: 0x7fdd80f41e20>. 

你会注意到我在viewDidLoad中有一个静态布尔值。 如果没有这个,viewDidLoad被无限调用,导致ViewController视图的顶部出现Nextanimation的animation循环。

我几乎100%肯定,我不应该实现布尔值,以防止循环,但这是唯一的办法,我可以。 做什么?

更新! 当我embedded导航控制器,并使用[self.navigationController presentViewController:viewController animated:NO completion:nil]; 我不经历循环。

虽然这解决了这个问题,但是改变观点(没有导航控制器)的问题依然存在