Inconsistent behavior in viewDidAppear Objective C

529 Views Asked by At

[ViewController] Calling -viewDidAppear: directly on a view controller is not supported, and may result in out-of-order callbacks and other inconsistent behavior. Use the -beginAppearanceTransition:animated: and -endAppearanceTransition APIs on UIViewController to manually drive appearance callbacks instead. Make a symbolic breakpoint at UIViewControllerAlertForAppearanceCallbackMisuse to catch this in the debugger

May i know the exact reason causing this issue.

Thanks in advance

2

There are 2 best solutions below

0
matt On

It seems, from the error message, that you are calling viewDidAppear:. Never do that (except to call super from within your implementation). It is an event method to be called by the runtime, not by you. That is what the error message is telling you.

If for some reason you don't know how to find your code where you are making this mistake, the error method also tells you how to set a breakpoint to find it when it happens.

0
CTABUYO On

You can't call the viewDidAppear: method by yourself.

Instead put whatever code you have inside viewDidAppear: and relocate to a new method which you define yourself. Then you can call that method just as you are calling viewDidAppear: now :)