Question: I have ONE viewController that is giving me a problem...

```
UIViewController *nextController = [[NextView alloc] initWithNibName:@"NextView" bundle:nil];
[currentPageController.view removeFromSuperview];
[self.view addSubview:nextController.view];

```

My app crashes here with an EXC\_BAD\_ACCESS.

Does anybody have ANY idea what could cause this? 

Thanks in advance!

**UPDATE**

After using Breakpoints and stepping through the code, the problem seems to be with this bit of code in the viewDidLoad of my viewController:

```
NSString *noteToSet;

        if ([Settings isData]) {
            noteToSet = [NSString stringWithFormat:@"Data, "];
        }
        if ([Settings isGeom]) {
            if ([noteToSet isEqualToString:@""]) {
                noteToSet = [NSString stringWithFormat:@"Geom, "];
            } else {
                noteToSet = [noteToSet stringByAppendingFormat:@"Geom, "];
            }
        }

```

Anybody see a problem there?
Thanks so much!

**FIXED**

Fixed it by initializing the string with the blank value @""

```
noteToSet = [NSString stringWithFormat:@""];

```

Answer: 
So the first part of the answer is - if your viewController won't load and you have no idea why - check the code in viewDidLoad, that's where my issue was and it drove me crazy trying to figure out what was wrong with the viewController itself when it was really an NSString issue in the viewDidLoad all along.

The second part is that you can't compare an NSString to a blank value using [stringName isEqualToString:@""] unless you got that string from NSUSerDefaults or unless you first set the string to be equal to @"".
I don't see anything in the posted code that'd cause the exception. However, both pieces of code that you posted contain the lines:

```
currentPageController = nextController;
[currentPageController retain];
[nextController release];

```

Since the first line makes currentPageController point to the same object as nextController, the second and third lines cancel each other out. You might as well write:

```
currentPageController = nextController;

```

and leave it at that. A similar misunderstanding at some other point in the code could easily cause you to miss a retain or release once too often and cause the sort of bad pointer that you seem to be seeing.