Just encountered a problem, now in this as a record, we have encountered can quickly find the reason, share ah.
In the app, users need to log in before they can use it, so I change the app's [uiapplicationsharedapplication]. Keywindow. Rootviewcontroller to control the jump of the interface.
The following problems occur during use:
1. After successful login, click the logout button, eject the logout prompt box uialertview;
2. Log out successfully and login again;
3. Click Logout again to no longer eject Uialertview.
The following warning is indicated:
Click the Logout button to perform the change Rootvie operation:
Attempt to dismiss modal view controller whose view does not currently appear
Click Sign out again when you are prompted:
Attempt to present <_UIModalItemsPresentingViewController:0x7f9d1b5b2fd0> on <_ Uimodalitemappviewcontroller:0x7f9d1d335520> whose view isnot in the window hierarchy!
My Code is:
Loginviewcontroller *LOGINVC = [[loginviewcontrolleralloc] init];
cnavigationcontroller *nav = [[cnavigationcontrolleralloc] initwithrootviewcontroller: LOGINVC];
[uiapplicationsharedapplication]. Keywindow. Rootviewcontroller = nav;
The main causes of this are :
Because I execute the above code is in:-(void) Alertview: (uialertview *) Alertview clickedbuttonatindex: (nsinteger) Buttonindex This method is performed;
So when I do switch root view controller Uialertview is not gone, so there will be the above error, the disappearance of Uialertview will take a certain amount of time,
Solution:
To solve this problem is another proxy method in Uialertview -(void) Alertview: (Uialertview *) Alertview diddismisswithbuttonindex: (nsinteger) buttonindex in the operation of switching the root controller, that is, my code above, that is, after the Uialertview completely disappear after the switch root controller, solve!
iOS development error attempt to dismiss modal view controller whose view does not currently appear