Local Declaration "x" hides instance variable xcode warning

Michael Robinson picture Michael Robinson · Mar 19, 2010 · Viewed 40k times · Source

I've been have trouble understand this problem. If I change the variable name fifthViewController the error goes away but the view controller doesn't load.

Lost. Once again it's probably something simple.

Thanks in advance.

Here is the code:

{
FifthViewController *fifthViewController = [[FifthViewController alloc] initWithNibName:@"FifthView" bundle:nil];

fifthViewController.transactionID = transactionID;
[self.navigationController pushViewController:fifthViewController animated:NO]; 
[fifthViewController release];
 }

Answer

Tim picture Tim · Mar 19, 2010

This means the variable fifthViewController is named the same as something else in your class implementation. If you mean to use that variable, drop the FifthViewController* type declaration off the first line; otherwise, change the name fifthViewController everywhere it appears in that method.