Q:

nsmutable array not saving values

My array is not saving the values I put in it...
I am defining my nsmutablearray *arrayClientList in .h file
@interface StartupTableViewController :     UIViewController<UITableViewDataSource, UITableViewDelegate>

  @property (strong, nonatomic) IBOutlet UITableView *tableView;

@property NSMutableArray *arrayClientList;
@property BOOL boolAddToClient;

//@property (strong, nonatomic) NSMutableArray *arrayAddClient;

@end

in .m file I am initializing like so
- (void)viewDidLoad {
[super viewDidLoad];

//initialize variables
self.arrayClientList = [[NSMutableArray alloc] init];
arraySelectedInformation = [[NSMutableArray alloc] init];
self.boolAddToClient = NO;

NSString *tstring = @"hello";
[self.arrayClientList addObject:tstring];

but then once I get to another method in this same class... the array is nil again.  I must be doing something stupid for the array not to hold the values
-(void)viewDidAppear:(BOOL)animated{
//NSLog(@"appeared");

if (self.boolAddToClient) {

    NSLog(@"add client to list");

    self.boolAddToClient = NO;
    [self.tableView reloadData];

}
else{

    NSLog(@"startup");

}

}
I am trying to use it in another class
- (IBAction)buttonSubmit:(id)sender {

NSString *userDescription = [[NSString alloc] init];
NSString *userUsername = [[NSString alloc] init];
NSString *userPassword = [[NSString alloc] init];

userDescription = self.textfieldDescription.text;
userUsername = self.textfieldUserID.text;
userPassword = self.textfieldPW.text;

//check to make sure user filled out all fields
if (![userDescription isEqual:@""] && ![userUsername isEqual:@""] && ![userPassword isEqual: @""]){

    NSLog(@"correct");

    NSArray *arrayVC = self.navigationController.viewControllers;
    StartupTableViewController *parentViewController = [arrayVC objectAtIndex:0];
    parentViewController.boolAddToClient = YES;

    NSMutableArray *arrayNewObjects = [[NSMutableArray alloc] initWithObjects:userDescription, userUsername, userPassword, nil];

    NSMutableArray *tarray = parentViewController.arrayClientList;
    [tarray addObject:arrayNewObjects];
    [parentViewController.arrayClientList addObject:arrayNewObjects];

    [self.navigationController popViewControllerAnimated:YES];

}
else{

    NSLog(@"something missing");

}

}

A:

Since I can't comment without rep, I must try with answer.
Try this:
In ViewDidLoad do alloc init with Strings you create in implementation and also change if block to this:
@implementation 
{
    NSString *userDescription;
    NSString *userUsername;
    NSString *userPassword;
}
-(void)viewDidLoad {
    [super viewDidLoad];
    NSString *userDescription = [[NSString alloc] init];
    NSString *userUsername = [[NSString alloc] init];
    NSString *userPassword = [[NSString alloc] init];
}
- (IBAction)buttonSubmit:(id)sender {
if (self.textfieldDescription.text.lenght != 0 && self.textfieldUserID.text.lenght != 0 && self.textfieldPW.text.lenght != 0) {
userDescription = self.textfieldDescription.text;
userUsername = self.textfieldUserID.text;
userPassword = self.textfieldPW.text;
....... and the rest
}

Please comment if it's not working, and I also think that you're not passing the informations right. Try searching an answer on how to pass arrays between TableViewControllers. Good Luck!

