Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blank screen for iOS 5 tab after dismissing modal and coming back from background after a memory warning

  1. Run a app with tabs using iOS 5 simulator or device
  2. Bring up a modal dialog
  3. Simulate memory warning (for devices go to some apps that are memory intensive)
  4. Switch to another app (if you have not done so already)
  5. Come back to the app
  6. Dismiss the dialog

You will see a blank screen (the window). Test project to demonstrate this bug / issue: http://github.com/chetanpungaliya/iOS-5-TestModal

like image 931
cpungaliya Avatar asked Nov 09 '11 23:11

cpungaliya


2 Answers

I ran into this myself today and can't find any explanation other than it's an iOS 5 bug. After a bit of hacking, I found a workaround. Before you dismiss the modal view controller, change tabBarController.selectedIndex to a different view controller index and then back again.

You can see this in a clone of your project at https://github.com/xjones/iOS-5-TestModal. I also submitted this to you as a pull request.

EDIT: added openradar report

Someone has also posted this on openradar: http://openradar.appspot.com/10529236

like image 152
XJones Avatar answered Sep 22 '22 23:09

XJones


I too had the same issue and fixed it. The problem is that the outlets that we connect via xib are set to nil in viewDidUnload method. This method is called on all views that are not currently visible, when memory warning occurs. When we come back to those views, their viewDidLoad method is called again. The only way to fix this is to remove setNil methods from viewDIdUnload to dealloc method and everything will work fine.

like image 42
arundevma Avatar answered Sep 23 '22 23:09

arundevma