I have a TabBar controller with 4 tabs, all the controller are embedded in Navigation Controller. On the 4th tab there is ViewControllerA which is push to ViewControllerB using embedded navigation controller. Now ControllerB has tableview which gets updated from async service call made every 5 seconds. I am saving the response in database and reloading tableview.
when the user go back to ControllerA and come back to ControllerB, at this point i am reloading the tableview in ViewDidLoad from the saved data in database.
Until this point everything works as expected. Tableview is refreshed with new data.
But when i get new data from service and try to reload data at this point my CellForRowAtIndexPath breaks and wont reload the table. While trying to recreate this issue I got this UITableViewAlertForLayoutOutsideViewHierarchy.
After testing this numerous time, i found out that ReloadData is not working as my TableView.Window is nil.
After doing some research i tried the suggested solution like reloading data in ViewDidAppear, wrapping up ReloadDate in DispatchQueue.Main, LayoutIfNeeded but nothing seems to work.
I don't know how the tableview is removed from view hierarchy after the reload data is called from ViewDidLoad.
Tableview is still visible but it just wont refresh anymore. But now if I going back to ControllerA and coming back to ControllerB, it will reload the tableview as latest data in fetched from database but again trying to update from server response will create the same issue.
Not sure how TableView.Window becomes nil.
when the user go back to ControllerA and come back to ControllerB, at this point i am reloading the tableview in ViewDidLoad from the saved data in database.
Until this point everything works as expected. Tableview is refreshed with new data.
But when i get new data from service and try to reload data at this point my CellForRowAtIndexPath breaks and wont reload the table. While trying to recreate this issue I got this UITableViewAlertForLayoutOutsideViewHierarchy.
After testing this numerous time, i found out that ReloadData is not working as my TableView.Window is nil.
After doing some research i tried the suggested solution like reloading data in ViewDidAppear, wrapping up ReloadDate in DispatchQueue.Main, LayoutIfNeeded but nothing seems to work.
I don't know how the tableview is removed from view hierarchy after the reload data is called from ViewDidLoad.
Tableview is still visible but it just wont refresh anymore. But now if I going back to ControllerA and coming back to ControllerB, it will reload the tableview as latest data in fetched from database but again trying to update from server response will create the same issue.
Not sure how TableView.Window becomes nil.