App crashing after reloading
<p>I am writing my first app that tries to deal with persistent data and am having some major troubles.  I finally feel like I am getting close but now the crash is crashing sporadically - I assume it is some sort of memory issue but have no clue how to fix it.  If I reset the settings of the iphone simulator and then run the app it works great for quite a while.  Then if i close the simulator and re-run the app, it will crash when this method is called:</p>

<pre><code>-(IBAction)selectedProfile {

NSInteger rowSelected = [profilePicker selectedRowInComponent:0];
NSUserDefaults *profiles = [NSUserDefaults standardUserDefaults];

if(rowSelected == 0) {
    [profiles setInteger:1 forKey:@"activeuser"];
} else if (rowSelected == 1) {
    [profiles setInteger:2 forKey:@"activeuser"];
} else if (rowSelected == 2) {
    [profiles setInteger:3 forKey:@"activeuser"];
}
[profiles synchronize];


FormsViewController *rootVC = [[FormsViewController alloc] init];

UINavigationController *theNavController = [[UINavigationController alloc]
                                             initWithRootViewController:rootVC];

theNavController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:theNavController animated:YES];

[rootVC release];
[theNavController release];
</code></pre>

<p>}</p>

<p>I am wondering if it has to do with the way I am dealing with the persistent data because I didn't have this problem prior to implementing it.  The user is given a UIPickerView with 3 options and the rest of the app is dependent on which of those 3 options the user chooses.  Could it be the persistent data?</p>
