You cannot create an instance of an object inside a case statement unless you place it in a new area. This is because otherwise you could do something like this:
switch( ... ) { case A: MyClass obj( constructor stuff );
If you want the object to continue throughout the entire period, you can do this:
switch( ... ) { case A: { MyClass obj( constructor stuff );
This is the same in Objective-C as well as in C and C ++.
source share