The best solution, if you can manage it, is to try to revise your code so that it doesn't matter whether the controller was just pushed or its child was just popped. Fundamentally, a view controller mediates between its view and the data that the app operates on. As long as that data is up to date, the controller shouldn't be concerned with what was happening before its view appeared. Tasks that your controller currently does based on the previous state of the app, such as updating the data, might really be better located in a different class.
Another possibility, if you're using storyboards, is to rely on -prepareForSegue:sender:
instead of -viewDidAppear
. The segue you're passed in that method has properties that identify the source and destination view controllers, and that's usually enough information to tell you how your controller came to be the current one.
If neither of those work in your case, consider moving your configuration code to one or more different methods. The root of the problem you're facing is that -viewWillAppear
really doesn't mean what you need it to. Create a method that does mean what you need, like -childControllerFinished
, and use that to do the configuration work that you need.