“Application tried to present modally an active controller” Error in iOS5

拟墨画扇 提交于 2019-12-05 19:45:05

You are getting this error because you are attempting to display the 'map' view controller twice. The first time is as the root view controller of 'navigationController' and the second time is via [split presentModalViewController:map animated:YES].

iOS 5 is being a bit more picky than iOS 4 when you try to do strange things with view controllers. Trying to show the same controller twice is a design problem - you need to work out what you are really trying to do and fix it.

(Also, calling a map view controller 'MapView' rather than 'MapViewController' is really confusing)

This error will also occur if you don't follow these guidelines: Creating Custom Content View Controllers

Basically, you need to call:

[yourVC removeFromParentViewController];

if you've

[parentVC addChildViewController:yourVC];

This error may often be paired with something about "UIViewControllerHierarchyInconsistency"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!