Raptor Raptor - 4 months ago 40
iOS Question

Unbalanced calls to begin/end appearance transitions for <UITabBarController: 0x197870>

I read SO about another user encountering similar error, but this error is in different case.

I received this message when I added a View Controller initially:

Unbalanced calls to begin/end appearance transitions for
<UITabBarController: 0x197870>


The structure of the app is as follow:

I got a 5-tab TabBarController linked to 5 View Controllers. In the initial showing tab, I call out a new View Controller to overlay as an introduction of the app.

I use this code to call the introduction view controller:

IntroVC *vc = [[IntroVC alloc] init];
[self presentModalViewController:vc animated:YES];
[vc release];


After this
IntroVC
view controller shows up, the above error shows.

p.s. I am using xCode 4.2 & iOS 5.0 SDK, developing iOS 4.3 app.

Answer

Without seeing more of the surrounding code I can't give a definite answer, but I have two theories.

  1. You're not using UIViewController's designated initializer initWithNibName:bundle:. Try using it instead of just init.

  2. Also, self may be one of the tab bar controller's view controllers. Always present view controllers from the topmost view controller, which means in this case ask the tab bar controller to present the overlay view controller on behalf of the view controller. You can still keep any callback delegates to the real view controller, but you must have the tab bar controller present and dismiss.