ios - Setting the rootViewController after a modal view has been presented -


i have app re-init app if it's been in background long. when user opens app after allotted time, re-init happens, , display splash screen while data need. when data server set window.rootviewcontroller property new value. if old root view controller has had view controller presented modally, , view controller being displayed when re-init happens, dealloc doesn't called on view controller (i've tested putting nslog's in dealloc method). in case modal view controller not presented, dealloc gets called expected.

does know of solution this? i'm not sure if it's apple bug, or if it's need handle on own.

the solution came before set rootviewcontroller, call

- (void)_dismissrootviewcontrollersmodalviewsifany {     uiviewcontroller *rootviewcontroller = self.window.rootviewcontroller;     if (rootviewcontroller.presentedviewcontroller || rootviewcontroller.presentingviewcontroller)      {         [rootviewcontroller dismissviewcontrolleranimated:no completion:nil];     } } 

this method created, makes sure if there modal view controller dismiss, dismissed.


Comments

Popular posts from this blog

php - Hide output during test execution -

javascript - Migrate custom AngularJS filter from 1.2.28 to 1.4.x -

Update Magento products with multiple images -