This is a general C restriction for switch -
You cannot declare local variables inside a separate case unless you put them in brackets {} .
The easiest way to do this is to place a declaration of UIViewController *vc; before switch and just put vc = [[whatever.. inside the case .
source share