I think i found a bug in IOS SDK but i'm not sure how to overcome this issue without heavily modifying my code.
The problem? If i present modal view controller, than the user moves the app to background state, When the user comes back to the app, i switch the rootViewController to a different view controller, where i validate the user session and make some more logic. After this step is finished, i replace my original rootViewController. The problem is that the modalViewController that was presented by the rootViewController, is hidden / not showing. when i try to dismiss it it gives me an error that i'm trying to dismiss a view that it isn't visible.
when i try to present it again (or just another view controller for example), it errors me that i try to present view controller when another view controller is presented.
So, i can't dismiss the modal view controller and i can't present a new one.
To summarize, it seems that if you present a modalviewcontroller, than change your rootViewController to another viewcontroller, and restore the original rootViewController -> Any modals that where presented is in kinda limbo state.
Anyone can figure this out? any solution other the "don't replace your rootviewcontroller"?
Thanks alot